import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.preprocessing import LabelEncoder
!pip install pandas
Requirement already satisfied: pandas in c:\users\intizar mehdi pc\anaconda3\lib\site-packages (1.5.3) Requirement already satisfied: numpy>=1.21.0 in c:\users\intizar mehdi pc\anaconda3\lib\site-packages (from pandas) (1.23.5) Requirement already satisfied: pytz>=2020.1 in c:\users\intizar mehdi pc\anaconda3\lib\site-packages (from pandas) (2022.7) Requirement already satisfied: python-dateutil>=2.8.1 in c:\users\intizar mehdi pc\anaconda3\lib\site-packages (from pandas) (2.8.2) Requirement already satisfied: six>=1.5 in c:\users\intizar mehdi pc\anaconda3\lib\site-packages (from python-dateutil>=2.8.1->pandas) (1.16.0)
data = pd.read_csv('E:/AI-Data.csv')
data.head(18)
| gender | NationalITy | PlaceofBirth | StageID | GradeID | SectionID | Topic | Semester | Relation | raisedhands | VisITedResources | AnnouncementsView | Discussion | ParentAnsweringSurvey | ParentschoolSatisfaction | StudentAbsenceDays | Class | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | M | KW | KuwaIT | lowerlevel | G-04 | A | IT | F | Father | 15 | 16 | 2 | 20 | Yes | Good | Under-7 | M |
| 1 | M | KW | KuwaIT | lowerlevel | G-04 | A | IT | F | Father | 20 | 20 | 3 | 25 | Yes | Good | Under-7 | M |
| 2 | M | KW | KuwaIT | lowerlevel | G-04 | A | IT | F | Father | 10 | 7 | 0 | 30 | No | Bad | Above-7 | L |
| 3 | M | KW | KuwaIT | lowerlevel | G-04 | A | IT | F | Father | 30 | 25 | 5 | 35 | No | Bad | Above-7 | L |
| 4 | M | KW | KuwaIT | lowerlevel | G-04 | A | IT | F | Father | 40 | 50 | 12 | 50 | No | Bad | Above-7 | M |
| 5 | F | KW | KuwaIT | lowerlevel | G-04 | A | IT | F | Father | 42 | 30 | 13 | 70 | Yes | Bad | Above-7 | M |
| 6 | M | KW | KuwaIT | MiddleSchool | G-07 | A | Math | F | Father | 35 | 12 | 0 | 17 | No | Bad | Above-7 | L |
| 7 | M | KW | KuwaIT | MiddleSchool | G-07 | A | Math | F | Father | 50 | 10 | 15 | 22 | Yes | Good | Under-7 | M |
| 8 | F | KW | KuwaIT | MiddleSchool | G-07 | A | Math | F | Father | 12 | 21 | 16 | 50 | Yes | Good | Under-7 | M |
| 9 | F | KW | KuwaIT | MiddleSchool | G-07 | B | IT | F | Father | 70 | 80 | 25 | 70 | Yes | Good | Under-7 | M |
| 10 | M | KW | KuwaIT | MiddleSchool | G-07 | A | Math | F | Father | 50 | 88 | 30 | 80 | Yes | Good | Under-7 | H |
| 11 | M | KW | KuwaIT | MiddleSchool | G-07 | B | Math | F | Father | 19 | 6 | 19 | 12 | Yes | Good | Under-7 | M |
| 12 | M | KW | KuwaIT | lowerlevel | G-04 | A | IT | F | Father | 5 | 1 | 0 | 11 | No | Bad | Above-7 | L |
| 13 | M | lebanon | lebanon | MiddleSchool | G-08 | A | Math | F | Father | 20 | 14 | 12 | 19 | No | Bad | Above-7 | L |
| 14 | F | KW | KuwaIT | MiddleSchool | G-08 | A | Math | F | Mum | 62 | 70 | 44 | 60 | No | Bad | Above-7 | H |
| 15 | F | KW | KuwaIT | MiddleSchool | G-06 | A | IT | F | Father | 30 | 40 | 22 | 66 | Yes | Good | Under-7 | M |
| 16 | M | KW | KuwaIT | MiddleSchool | G-07 | B | IT | F | Father | 36 | 30 | 20 | 80 | No | Bad | Above-7 | M |
| 17 | M | KW | KuwaIT | MiddleSchool | G-07 | A | Math | F | Father | 55 | 13 | 35 | 90 | No | Bad | Above-7 | M |
print('percentage',data.gender.value_counts(normalize=True))
data.gender.value_counts(normalize=True).plot(kind='pie')
percentage M 0.635417 F 0.364583 Name: gender, dtype: float64
<Axes: ylabel='gender'>
print('percentage',data.NationalITy.value_counts(normalize=True))
data.NationalITy.value_counts(normalize=True).plot(kind='bar')
percentage KW 0.372917 Jordan 0.358333 Palestine 0.058333 Iraq 0.045833 lebanon 0.035417 Tunis 0.025000 SaudiArabia 0.022917 Egypt 0.018750 Syria 0.014583 USA 0.012500 Iran 0.012500 Lybia 0.012500 Morocco 0.008333 venzuela 0.002083 Name: NationalITy, dtype: float64
<Axes: >
print('percentage',data.PlaceofBirth.value_counts(normalize=True))
data.PlaceofBirth.value_counts(normalize=True).plot(kind='bar')
percentage KuwaIT 0.375000 Jordan 0.366667 Iraq 0.045833 lebanon 0.039583 SaudiArabia 0.033333 USA 0.033333 Palestine 0.020833 Egypt 0.018750 Tunis 0.018750 Iran 0.012500 Syria 0.012500 Lybia 0.012500 Morocco 0.008333 venzuela 0.002083 Name: PlaceofBirth, dtype: float64
<Axes: >
print('percentage',data.SectionID.value_counts(normalize=True))
data.SectionID.value_counts(normalize=True).plot(kind='pie')
percentage A 0.589583 B 0.347917 C 0.062500 Name: SectionID, dtype: float64
<Axes: ylabel='SectionID'>
print('percentage',data.Topic.value_counts(normalize=True))
data.Topic.value_counts(normalize=True).plot(kind='bar')
percentage IT 0.197917 French 0.135417 Arabic 0.122917 Science 0.106250 English 0.093750 Biology 0.062500 Spanish 0.052083 Chemistry 0.050000 Geology 0.050000 Quran 0.045833 Math 0.043750 History 0.039583 Name: Topic, dtype: float64
<Axes: >
print('percentage',data.GradeID.value_counts(normalize=True))
data.GradeID.value_counts(normalize=True).plot(kind='bar')
percentage G-02 0.306250 G-08 0.241667 G-07 0.210417 G-04 0.100000 G-06 0.066667 G-11 0.027083 G-12 0.022917 G-09 0.010417 G-10 0.008333 G-05 0.006250 Name: GradeID, dtype: float64
<Axes: >
print('percentage',data.Semester.value_counts(normalize=True))
data.Semester.value_counts(normalize=True).plot(kind='pie')
percentage F 0.510417 S 0.489583 Name: Semester, dtype: float64
<Axes: ylabel='Semester'>
print('percentage',data.Relation.value_counts(normalize=True))
data.Relation.value_counts(normalize=True).plot(kind='bar')
percentage Father 0.589583 Mum 0.410417 Name: Relation, dtype: float64
<Axes: >
print('percentage',data.raisedhands.value_counts(normalize=True))
data.raisedhands.value_counts(normalize=True).plot(kind='bar',figsize=(60,50),fontsize=40)
percentage 10 0.064583
70 0.064583
80 0.058333
72 0.035417
50 0.035417
...
61 0.002083
83 0.002083
52 0.002083
67 0.002083
97 0.002083
Name: raisedhands, Length: 82, dtype: float64
<Axes: >
print('percentage',data.Discussion.value_counts(normalize=True))
data.Discussion.value_counts(normalize=True).plot(kind='bar')
percentage 70 0.050000
40 0.047917
33 0.043750
50 0.037500
30 0.035417
...
95 0.002083
65 0.002083
76 0.002083
73 0.002083
62 0.002083
Name: Discussion, Length: 90, dtype: float64
<Axes: >
print('percentage',data.GradeID.value_counts(normalize=True))
data.GradeID.value_counts(normalize=True).plot(kind='bar')
percentage G-02 0.306250 G-08 0.241667 G-07 0.210417 G-04 0.100000 G-06 0.066667 G-11 0.027083 G-12 0.022917 G-09 0.010417 G-10 0.008333 G-05 0.006250 Name: GradeID, dtype: float64
<Axes: >
print('percentage',data.raisedhands.value_counts(normalize=True))
data.raisedhands.value_counts(normalize=True).plot(kind='bar')
percentage 10 0.064583
70 0.064583
80 0.058333
72 0.035417
50 0.035417
...
61 0.002083
83 0.002083
52 0.002083
67 0.002083
97 0.002083
Name: raisedhands, Length: 82, dtype: float64
<Axes: >
print('percentage',data.VisITedResources.value_counts(normalize=True))
data.VisITedResources.value_counts(normalize=True).plot(kind='bar')
percentage 80 0.060417
90 0.060417
82 0.033333
12 0.027083
88 0.027083
...
63 0.002083
55 0.002083
54 0.002083
1 0.002083
78 0.002083
Name: VisITedResources, Length: 89, dtype: float64
<Axes: >
print('percentage',data.AnnouncementsView.value_counts(normalize=True))
data.AnnouncementsView.value_counts(normalize=True).plot(kind='pie')
percentage 12 0.043750
42 0.033333
50 0.033333
40 0.033333
2 0.029167
...
93 0.002083
17 0.002083
24 0.002083
91 0.002083
78 0.002083
Name: AnnouncementsView, Length: 88, dtype: float64
<Axes: ylabel='AnnouncementsView'>
print('percentage',data.StudentAbsenceDays.value_counts(normalize=True))
data.StudentAbsenceDays.value_counts(normalize=True).plot(kind='pie')
percentage Under-7 0.602083 Above-7 0.397917 Name: StudentAbsenceDays, dtype: float64
<Axes: ylabel='StudentAbsenceDays'>
print('percentage',data.Class.value_counts(normalize=True))
data.Class.value_counts(normalize=True).plot(kind='pie')
percentage M 0.439583 H 0.295833 L 0.264583 Name: Class, dtype: float64
<Axes: ylabel='Class'>
import matplotlib.pyplot as plt
import seaborn as sns
fig, axarr=plt.subplots(2,2,figsize=(20,20))
sns.countplot(x='Class',data=data, ax=axarr[0,0])
sns.countplot(x='gender',data=data, ax=axarr[0,1])
sns.countplot(x='StageID',data=data, ax=axarr[1,0])
sns.countplot(x='Semester',data=data, ax=axarr[0,1])
<Axes: xlabel='Semester', ylabel='count'>
fig, axarr=plt.subplots(2,2,figsize=(20,20))
sns.countplot(x='Topic',data=data, ax=axarr[0,0])
sns.countplot(x='VisITedResources',data=data, ax=axarr[0,1])
sns.countplot(x='StudentAbsenceDays',data=data, ax=axarr[1,0])
sns.countplot(x='Relation',data=data, ax=axarr[0,1])
<Axes: xlabel='Relation', ylabel='count'>
fig, axarr=plt.subplots(2,1,figsize=(20,20))
sns.countplot(x='Topic',data=data, ax=axarr[0])
sns.countplot(x='NationalITy',data=data, ax=axarr[1])
<Axes: xlabel='NationalITy', ylabel='count'>
fig, axarr=plt.subplots(2,1,figsize=(20,20))
sns.countplot(x='StudentAbsenceDays',data=data, ax=axarr[0])
sns.countplot(x='Class',data=data, ax=axarr[1])
<Axes: xlabel='Class', ylabel='count'>
fig, axarr=plt.subplots(2,2,figsize=(20,20))
sns.countplot(x='gender',hue='Class',data=data, ax=axarr[0,0],order=['M','F'],hue_order=['L','M','H'])
sns.countplot(x='gender',hue='Relation',data=data, ax=axarr[0,1],order=['M','F'])
sns.countplot(x='gender',hue='StudentAbsenceDays',data=data, ax=axarr[1,0])
sns.countplot(x='gender',hue='ParentAnsweringSurvey',data=data, ax=axarr[1,1])
<Axes: xlabel='gender', ylabel='count'>
fig,axarr=plt.subplots(2,1,figsize=(25,25))
sns.countplot(x='NationalITy',hue='Relation',data=data, ax=axarr[0])
sns.countplot(x='NationalITy',hue='Relation',data=data, ax=axarr[1])
<Axes: xlabel='NationalITy', ylabel='count'>
import matplotlib.pyplot as plt
import seaborn as sns
fig, axarr=plt.subplots(2,2,figsize=(20,20))
sns.barplot(x='Class',y='raisedhands',data=data,ax=axarr[0,0])
sns.barplot(x='Class',y='Discussion',data=data,ax=axarr[0,1])
sns.barplot(x='Class',y='VisITedResources',data=data,ax=axarr[1,0])
sns.barplot(x='Class',y='AnnouncementsView',data=data,ax=axarr[1,1])
<Axes: xlabel='Class', ylabel='AnnouncementsView'>
fig,(axis1,axis2,)=plt.subplots(1,2,figsize=(10,5))
sns.barplot(x='gender',y='raisedhands',data=data, ax=axis1)
sns.barplot(x='gender',y='raisedhands',data=data, ax=axis2)
<Axes: xlabel='gender', ylabel='raisedhands'>
fig,(axis1,axis2)=plt.subplots(1,2,figsize=(20,10))
sns.boxplot(x='gender',y='AnnouncementsView',data=data, ax=axis1)
sns.boxplot(x='gender',y='raisedhands',data=data, ax=axis2)
<Axes: xlabel='gender', ylabel='raisedhands'>
fig,(axis1,axis2)=plt.subplots(1,2,figsize=(20,10))
sns.boxplot(x='Class',y='Discussion',data=data, ax=axis1)
sns.boxplot(x='Class',y='VisITedResources',data=data, ax=axis2)
<Axes: xlabel='Class', ylabel='VisITedResources'>
fig,(axis1,axis2)=plt.subplots(1,2,figsize=(10,5))
sns.pointplot(x='Semester',y='VisITedResources',hue='Relation',data=data, ax=axis1)
sns.pointplot(x='Semester',y='AnnouncementsView',hue='Relation',data=data, ax=axis2)
<Axes: xlabel='Semester', ylabel='AnnouncementsView'>
fig,(axis1,axis2)=plt.subplots(1,2,figsize=(20,10))
sns.regplot(x='AnnouncementsView',y='Discussion',data=data, ax=axis1)
sns.regplot(x='raisedhands',y='VisITedResources',data=data, ax=axis2)
<Axes: xlabel='raisedhands', ylabel='VisITedResources'>
plot=sns.countplot(x='Class',hue='Relation',data=data,order=['L','M','H'],palette='Set1')
plot.set(xlabel='Class',ylabel='count',title='Gender comparison')
plt.show()
sns.pairplot(data,hue='Class')
<seaborn.axisgrid.PairGrid at 0x21c4c14d720>
sns.pairplot(data,hue='Relation')
<seaborn.axisgrid.PairGrid at 0x21c4c02ebf0>
sns.pairplot(data,hue='AnnouncementsView')
<seaborn.axisgrid.PairGrid at 0x21c4bde97b0>
sns.pairplot(data,hue='Discussion')
<seaborn.axisgrid.PairGrid at 0x21c4ea39f00>
sns.pairplot(data,hue='raisedhands')
<seaborn.axisgrid.PairGrid at 0x21c4eaac9a0>
sns.pairplot(data,hue='VisITedResources')
<seaborn.axisgrid.PairGrid at 0x21c523ccdc0>
sns.pairplot(data,hue='Semester')
<seaborn.axisgrid.PairGrid at 0x21c49817b20>
from sklearn.preprocessing import LabelEncoder
from sklearn.preprocessing import LabelEncoder
Features = data.drop('NationalITy',axis=1)
Target = data['NationalITy']
label = LabelEncoder()
Cat_colums = Features.dtypes.pipe(lambda Feature: Feature[Feature=='object']).index
for col in Cat_colums:
Features[col]=label.fit_transform(Features[col])
print(Features)
gender PlaceofBirth StageID GradeID SectionID Topic Semester \
0 1 KuwaIT lowerlevel G-04 A IT F
1 1 KuwaIT lowerlevel G-04 A IT F
2 1 KuwaIT lowerlevel G-04 A IT F
3 1 KuwaIT lowerlevel G-04 A IT F
4 1 KuwaIT lowerlevel G-04 A IT F
.. ... ... ... ... ... ... ...
475 0 Jordan MiddleSchool G-08 A Chemistry S
476 0 Jordan MiddleSchool G-08 A Geology F
477 0 Jordan MiddleSchool G-08 A Geology S
478 0 Jordan MiddleSchool G-08 A History F
479 0 Jordan MiddleSchool G-08 A History S
Relation raisedhands VisITedResources AnnouncementsView Discussion \
0 Father 15 16 2 20
1 Father 20 20 3 25
2 Father 10 7 0 30
3 Father 30 25 5 35
4 Father 40 50 12 50
.. ... ... ... ... ...
475 Father 5 4 5 8
476 Father 50 77 14 28
477 Father 55 74 25 29
478 Father 30 17 14 57
479 Father 35 14 23 62
ParentAnsweringSurvey ParentschoolSatisfaction StudentAbsenceDays Class
0 Yes Good Under-7 M
1 Yes Good Under-7 M
2 No Bad Above-7 L
3 No Bad Above-7 L
4 No Bad Above-7 M
.. ... ... ... ...
475 No Bad Above-7 L
476 No Bad Under-7 M
477 No Bad Under-7 M
478 No Bad Above-7 L
479 No Bad Above-7 L
[480 rows x 16 columns]
gender PlaceofBirth StageID GradeID SectionID Topic Semester \
0 1 4 lowerlevel G-04 A IT F
1 1 4 lowerlevel G-04 A IT F
2 1 4 lowerlevel G-04 A IT F
3 1 4 lowerlevel G-04 A IT F
4 1 4 lowerlevel G-04 A IT F
.. ... ... ... ... ... ... ...
475 0 3 MiddleSchool G-08 A Chemistry S
476 0 3 MiddleSchool G-08 A Geology F
477 0 3 MiddleSchool G-08 A Geology S
478 0 3 MiddleSchool G-08 A History F
479 0 3 MiddleSchool G-08 A History S
Relation raisedhands VisITedResources AnnouncementsView Discussion \
0 Father 15 16 2 20
1 Father 20 20 3 25
2 Father 10 7 0 30
3 Father 30 25 5 35
4 Father 40 50 12 50
.. ... ... ... ... ...
475 Father 5 4 5 8
476 Father 50 77 14 28
477 Father 55 74 25 29
478 Father 30 17 14 57
479 Father 35 14 23 62
ParentAnsweringSurvey ParentschoolSatisfaction StudentAbsenceDays Class
0 Yes Good Under-7 M
1 Yes Good Under-7 M
2 No Bad Above-7 L
3 No Bad Above-7 L
4 No Bad Above-7 M
.. ... ... ... ...
475 No Bad Above-7 L
476 No Bad Under-7 M
477 No Bad Under-7 M
478 No Bad Above-7 L
479 No Bad Above-7 L
[480 rows x 16 columns]
gender PlaceofBirth StageID GradeID SectionID Topic Semester \
0 1 4 2 G-04 A IT F
1 1 4 2 G-04 A IT F
2 1 4 2 G-04 A IT F
3 1 4 2 G-04 A IT F
4 1 4 2 G-04 A IT F
.. ... ... ... ... ... ... ...
475 0 3 1 G-08 A Chemistry S
476 0 3 1 G-08 A Geology F
477 0 3 1 G-08 A Geology S
478 0 3 1 G-08 A History F
479 0 3 1 G-08 A History S
Relation raisedhands VisITedResources AnnouncementsView Discussion \
0 Father 15 16 2 20
1 Father 20 20 3 25
2 Father 10 7 0 30
3 Father 30 25 5 35
4 Father 40 50 12 50
.. ... ... ... ... ...
475 Father 5 4 5 8
476 Father 50 77 14 28
477 Father 55 74 25 29
478 Father 30 17 14 57
479 Father 35 14 23 62
ParentAnsweringSurvey ParentschoolSatisfaction StudentAbsenceDays Class
0 Yes Good Under-7 M
1 Yes Good Under-7 M
2 No Bad Above-7 L
3 No Bad Above-7 L
4 No Bad Above-7 M
.. ... ... ... ...
475 No Bad Above-7 L
476 No Bad Under-7 M
477 No Bad Under-7 M
478 No Bad Above-7 L
479 No Bad Above-7 L
[480 rows x 16 columns]
gender PlaceofBirth StageID GradeID SectionID Topic Semester \
0 1 4 2 1 A IT F
1 1 4 2 1 A IT F
2 1 4 2 1 A IT F
3 1 4 2 1 A IT F
4 1 4 2 1 A IT F
.. ... ... ... ... ... ... ...
475 0 3 1 5 A Chemistry S
476 0 3 1 5 A Geology F
477 0 3 1 5 A Geology S
478 0 3 1 5 A History F
479 0 3 1 5 A History S
Relation raisedhands VisITedResources AnnouncementsView Discussion \
0 Father 15 16 2 20
1 Father 20 20 3 25
2 Father 10 7 0 30
3 Father 30 25 5 35
4 Father 40 50 12 50
.. ... ... ... ... ...
475 Father 5 4 5 8
476 Father 50 77 14 28
477 Father 55 74 25 29
478 Father 30 17 14 57
479 Father 35 14 23 62
ParentAnsweringSurvey ParentschoolSatisfaction StudentAbsenceDays Class
0 Yes Good Under-7 M
1 Yes Good Under-7 M
2 No Bad Above-7 L
3 No Bad Above-7 L
4 No Bad Above-7 M
.. ... ... ... ...
475 No Bad Above-7 L
476 No Bad Under-7 M
477 No Bad Under-7 M
478 No Bad Above-7 L
479 No Bad Above-7 L
[480 rows x 16 columns]
gender PlaceofBirth StageID GradeID SectionID Topic Semester \
0 1 4 2 1 0 IT F
1 1 4 2 1 0 IT F
2 1 4 2 1 0 IT F
3 1 4 2 1 0 IT F
4 1 4 2 1 0 IT F
.. ... ... ... ... ... ... ...
475 0 3 1 5 0 Chemistry S
476 0 3 1 5 0 Geology F
477 0 3 1 5 0 Geology S
478 0 3 1 5 0 History F
479 0 3 1 5 0 History S
Relation raisedhands VisITedResources AnnouncementsView Discussion \
0 Father 15 16 2 20
1 Father 20 20 3 25
2 Father 10 7 0 30
3 Father 30 25 5 35
4 Father 40 50 12 50
.. ... ... ... ... ...
475 Father 5 4 5 8
476 Father 50 77 14 28
477 Father 55 74 25 29
478 Father 30 17 14 57
479 Father 35 14 23 62
ParentAnsweringSurvey ParentschoolSatisfaction StudentAbsenceDays Class
0 Yes Good Under-7 M
1 Yes Good Under-7 M
2 No Bad Above-7 L
3 No Bad Above-7 L
4 No Bad Above-7 M
.. ... ... ... ...
475 No Bad Above-7 L
476 No Bad Under-7 M
477 No Bad Under-7 M
478 No Bad Above-7 L
479 No Bad Above-7 L
[480 rows x 16 columns]
gender PlaceofBirth StageID GradeID SectionID Topic Semester \
0 1 4 2 1 0 7 F
1 1 4 2 1 0 7 F
2 1 4 2 1 0 7 F
3 1 4 2 1 0 7 F
4 1 4 2 1 0 7 F
.. ... ... ... ... ... ... ...
475 0 3 1 5 0 2 S
476 0 3 1 5 0 5 F
477 0 3 1 5 0 5 S
478 0 3 1 5 0 6 F
479 0 3 1 5 0 6 S
Relation raisedhands VisITedResources AnnouncementsView Discussion \
0 Father 15 16 2 20
1 Father 20 20 3 25
2 Father 10 7 0 30
3 Father 30 25 5 35
4 Father 40 50 12 50
.. ... ... ... ... ...
475 Father 5 4 5 8
476 Father 50 77 14 28
477 Father 55 74 25 29
478 Father 30 17 14 57
479 Father 35 14 23 62
ParentAnsweringSurvey ParentschoolSatisfaction StudentAbsenceDays Class
0 Yes Good Under-7 M
1 Yes Good Under-7 M
2 No Bad Above-7 L
3 No Bad Above-7 L
4 No Bad Above-7 M
.. ... ... ... ...
475 No Bad Above-7 L
476 No Bad Under-7 M
477 No Bad Under-7 M
478 No Bad Above-7 L
479 No Bad Above-7 L
[480 rows x 16 columns]
gender PlaceofBirth StageID GradeID SectionID Topic Semester \
0 1 4 2 1 0 7 0
1 1 4 2 1 0 7 0
2 1 4 2 1 0 7 0
3 1 4 2 1 0 7 0
4 1 4 2 1 0 7 0
.. ... ... ... ... ... ... ...
475 0 3 1 5 0 2 1
476 0 3 1 5 0 5 0
477 0 3 1 5 0 5 1
478 0 3 1 5 0 6 0
479 0 3 1 5 0 6 1
Relation raisedhands VisITedResources AnnouncementsView Discussion \
0 Father 15 16 2 20
1 Father 20 20 3 25
2 Father 10 7 0 30
3 Father 30 25 5 35
4 Father 40 50 12 50
.. ... ... ... ... ...
475 Father 5 4 5 8
476 Father 50 77 14 28
477 Father 55 74 25 29
478 Father 30 17 14 57
479 Father 35 14 23 62
ParentAnsweringSurvey ParentschoolSatisfaction StudentAbsenceDays Class
0 Yes Good Under-7 M
1 Yes Good Under-7 M
2 No Bad Above-7 L
3 No Bad Above-7 L
4 No Bad Above-7 M
.. ... ... ... ...
475 No Bad Above-7 L
476 No Bad Under-7 M
477 No Bad Under-7 M
478 No Bad Above-7 L
479 No Bad Above-7 L
[480 rows x 16 columns]
gender PlaceofBirth StageID GradeID SectionID Topic Semester \
0 1 4 2 1 0 7 0
1 1 4 2 1 0 7 0
2 1 4 2 1 0 7 0
3 1 4 2 1 0 7 0
4 1 4 2 1 0 7 0
.. ... ... ... ... ... ... ...
475 0 3 1 5 0 2 1
476 0 3 1 5 0 5 0
477 0 3 1 5 0 5 1
478 0 3 1 5 0 6 0
479 0 3 1 5 0 6 1
Relation raisedhands VisITedResources AnnouncementsView Discussion \
0 0 15 16 2 20
1 0 20 20 3 25
2 0 10 7 0 30
3 0 30 25 5 35
4 0 40 50 12 50
.. ... ... ... ... ...
475 0 5 4 5 8
476 0 50 77 14 28
477 0 55 74 25 29
478 0 30 17 14 57
479 0 35 14 23 62
ParentAnsweringSurvey ParentschoolSatisfaction StudentAbsenceDays Class
0 Yes Good Under-7 M
1 Yes Good Under-7 M
2 No Bad Above-7 L
3 No Bad Above-7 L
4 No Bad Above-7 M
.. ... ... ... ...
475 No Bad Above-7 L
476 No Bad Under-7 M
477 No Bad Under-7 M
478 No Bad Above-7 L
479 No Bad Above-7 L
[480 rows x 16 columns]
gender PlaceofBirth StageID GradeID SectionID Topic Semester \
0 1 4 2 1 0 7 0
1 1 4 2 1 0 7 0
2 1 4 2 1 0 7 0
3 1 4 2 1 0 7 0
4 1 4 2 1 0 7 0
.. ... ... ... ... ... ... ...
475 0 3 1 5 0 2 1
476 0 3 1 5 0 5 0
477 0 3 1 5 0 5 1
478 0 3 1 5 0 6 0
479 0 3 1 5 0 6 1
Relation raisedhands VisITedResources AnnouncementsView Discussion \
0 0 15 16 2 20
1 0 20 20 3 25
2 0 10 7 0 30
3 0 30 25 5 35
4 0 40 50 12 50
.. ... ... ... ... ...
475 0 5 4 5 8
476 0 50 77 14 28
477 0 55 74 25 29
478 0 30 17 14 57
479 0 35 14 23 62
ParentAnsweringSurvey ParentschoolSatisfaction StudentAbsenceDays Class
0 1 Good Under-7 M
1 1 Good Under-7 M
2 0 Bad Above-7 L
3 0 Bad Above-7 L
4 0 Bad Above-7 M
.. ... ... ... ...
475 0 Bad Above-7 L
476 0 Bad Under-7 M
477 0 Bad Under-7 M
478 0 Bad Above-7 L
479 0 Bad Above-7 L
[480 rows x 16 columns]
gender PlaceofBirth StageID GradeID SectionID Topic Semester \
0 1 4 2 1 0 7 0
1 1 4 2 1 0 7 0
2 1 4 2 1 0 7 0
3 1 4 2 1 0 7 0
4 1 4 2 1 0 7 0
.. ... ... ... ... ... ... ...
475 0 3 1 5 0 2 1
476 0 3 1 5 0 5 0
477 0 3 1 5 0 5 1
478 0 3 1 5 0 6 0
479 0 3 1 5 0 6 1
Relation raisedhands VisITedResources AnnouncementsView Discussion \
0 0 15 16 2 20
1 0 20 20 3 25
2 0 10 7 0 30
3 0 30 25 5 35
4 0 40 50 12 50
.. ... ... ... ... ...
475 0 5 4 5 8
476 0 50 77 14 28
477 0 55 74 25 29
478 0 30 17 14 57
479 0 35 14 23 62
ParentAnsweringSurvey ParentschoolSatisfaction StudentAbsenceDays Class
0 1 1 Under-7 M
1 1 1 Under-7 M
2 0 0 Above-7 L
3 0 0 Above-7 L
4 0 0 Above-7 M
.. ... ... ... ...
475 0 0 Above-7 L
476 0 0 Under-7 M
477 0 0 Under-7 M
478 0 0 Above-7 L
479 0 0 Above-7 L
[480 rows x 16 columns]
gender PlaceofBirth StageID GradeID SectionID Topic Semester \
0 1 4 2 1 0 7 0
1 1 4 2 1 0 7 0
2 1 4 2 1 0 7 0
3 1 4 2 1 0 7 0
4 1 4 2 1 0 7 0
.. ... ... ... ... ... ... ...
475 0 3 1 5 0 2 1
476 0 3 1 5 0 5 0
477 0 3 1 5 0 5 1
478 0 3 1 5 0 6 0
479 0 3 1 5 0 6 1
Relation raisedhands VisITedResources AnnouncementsView Discussion \
0 0 15 16 2 20
1 0 20 20 3 25
2 0 10 7 0 30
3 0 30 25 5 35
4 0 40 50 12 50
.. ... ... ... ... ...
475 0 5 4 5 8
476 0 50 77 14 28
477 0 55 74 25 29
478 0 30 17 14 57
479 0 35 14 23 62
ParentAnsweringSurvey ParentschoolSatisfaction StudentAbsenceDays Class
0 1 1 1 M
1 1 1 1 M
2 0 0 0 L
3 0 0 0 L
4 0 0 0 M
.. ... ... ... ...
475 0 0 0 L
476 0 0 1 M
477 0 0 1 M
478 0 0 0 L
479 0 0 0 L
[480 rows x 16 columns]
gender PlaceofBirth StageID GradeID SectionID Topic Semester \
0 1 4 2 1 0 7 0
1 1 4 2 1 0 7 0
2 1 4 2 1 0 7 0
3 1 4 2 1 0 7 0
4 1 4 2 1 0 7 0
.. ... ... ... ... ... ... ...
475 0 3 1 5 0 2 1
476 0 3 1 5 0 5 0
477 0 3 1 5 0 5 1
478 0 3 1 5 0 6 0
479 0 3 1 5 0 6 1
Relation raisedhands VisITedResources AnnouncementsView Discussion \
0 0 15 16 2 20
1 0 20 20 3 25
2 0 10 7 0 30
3 0 30 25 5 35
4 0 40 50 12 50
.. ... ... ... ... ...
475 0 5 4 5 8
476 0 50 77 14 28
477 0 55 74 25 29
478 0 30 17 14 57
479 0 35 14 23 62
ParentAnsweringSurvey ParentschoolSatisfaction StudentAbsenceDays \
0 1 1 1
1 1 1 1
2 0 0 0
3 0 0 0
4 0 0 0
.. ... ... ...
475 0 0 0
476 0 0 1
477 0 0 1
478 0 0 0
479 0 0 0
Class
0 2
1 2
2 1
3 1
4 2
.. ...
475 1
476 2
477 2
478 1
479 1
[480 rows x 16 columns]
from sklearn.preprocessing import LabelEncoder
Features = data.drop('PlaceofBirth',axis=1)
Target = data['PlaceofBirth']
label = LabelEncoder()
Cat_colums = Features.dtypes.pipe(lambda Feature: Feature[Feature=='object']).index
for col in Cat_colums:
Features[col]=label.fit_transform(Features[col])
print(Features)
gender NationalITy StageID GradeID SectionID Topic Semester \
0 1 KW lowerlevel G-04 A IT F
1 1 KW lowerlevel G-04 A IT F
2 1 KW lowerlevel G-04 A IT F
3 1 KW lowerlevel G-04 A IT F
4 1 KW lowerlevel G-04 A IT F
.. ... ... ... ... ... ... ...
475 0 Jordan MiddleSchool G-08 A Chemistry S
476 0 Jordan MiddleSchool G-08 A Geology F
477 0 Jordan MiddleSchool G-08 A Geology S
478 0 Jordan MiddleSchool G-08 A History F
479 0 Jordan MiddleSchool G-08 A History S
Relation raisedhands VisITedResources AnnouncementsView Discussion \
0 Father 15 16 2 20
1 Father 20 20 3 25
2 Father 10 7 0 30
3 Father 30 25 5 35
4 Father 40 50 12 50
.. ... ... ... ... ...
475 Father 5 4 5 8
476 Father 50 77 14 28
477 Father 55 74 25 29
478 Father 30 17 14 57
479 Father 35 14 23 62
ParentAnsweringSurvey ParentschoolSatisfaction StudentAbsenceDays Class
0 Yes Good Under-7 M
1 Yes Good Under-7 M
2 No Bad Above-7 L
3 No Bad Above-7 L
4 No Bad Above-7 M
.. ... ... ... ...
475 No Bad Above-7 L
476 No Bad Under-7 M
477 No Bad Under-7 M
478 No Bad Above-7 L
479 No Bad Above-7 L
[480 rows x 16 columns]
gender NationalITy StageID GradeID SectionID Topic Semester \
0 1 4 lowerlevel G-04 A IT F
1 1 4 lowerlevel G-04 A IT F
2 1 4 lowerlevel G-04 A IT F
3 1 4 lowerlevel G-04 A IT F
4 1 4 lowerlevel G-04 A IT F
.. ... ... ... ... ... ... ...
475 0 3 MiddleSchool G-08 A Chemistry S
476 0 3 MiddleSchool G-08 A Geology F
477 0 3 MiddleSchool G-08 A Geology S
478 0 3 MiddleSchool G-08 A History F
479 0 3 MiddleSchool G-08 A History S
Relation raisedhands VisITedResources AnnouncementsView Discussion \
0 Father 15 16 2 20
1 Father 20 20 3 25
2 Father 10 7 0 30
3 Father 30 25 5 35
4 Father 40 50 12 50
.. ... ... ... ... ...
475 Father 5 4 5 8
476 Father 50 77 14 28
477 Father 55 74 25 29
478 Father 30 17 14 57
479 Father 35 14 23 62
ParentAnsweringSurvey ParentschoolSatisfaction StudentAbsenceDays Class
0 Yes Good Under-7 M
1 Yes Good Under-7 M
2 No Bad Above-7 L
3 No Bad Above-7 L
4 No Bad Above-7 M
.. ... ... ... ...
475 No Bad Above-7 L
476 No Bad Under-7 M
477 No Bad Under-7 M
478 No Bad Above-7 L
479 No Bad Above-7 L
[480 rows x 16 columns]
gender NationalITy StageID GradeID SectionID Topic Semester \
0 1 4 2 G-04 A IT F
1 1 4 2 G-04 A IT F
2 1 4 2 G-04 A IT F
3 1 4 2 G-04 A IT F
4 1 4 2 G-04 A IT F
.. ... ... ... ... ... ... ...
475 0 3 1 G-08 A Chemistry S
476 0 3 1 G-08 A Geology F
477 0 3 1 G-08 A Geology S
478 0 3 1 G-08 A History F
479 0 3 1 G-08 A History S
Relation raisedhands VisITedResources AnnouncementsView Discussion \
0 Father 15 16 2 20
1 Father 20 20 3 25
2 Father 10 7 0 30
3 Father 30 25 5 35
4 Father 40 50 12 50
.. ... ... ... ... ...
475 Father 5 4 5 8
476 Father 50 77 14 28
477 Father 55 74 25 29
478 Father 30 17 14 57
479 Father 35 14 23 62
ParentAnsweringSurvey ParentschoolSatisfaction StudentAbsenceDays Class
0 Yes Good Under-7 M
1 Yes Good Under-7 M
2 No Bad Above-7 L
3 No Bad Above-7 L
4 No Bad Above-7 M
.. ... ... ... ...
475 No Bad Above-7 L
476 No Bad Under-7 M
477 No Bad Under-7 M
478 No Bad Above-7 L
479 No Bad Above-7 L
[480 rows x 16 columns]
gender NationalITy StageID GradeID SectionID Topic Semester \
0 1 4 2 1 A IT F
1 1 4 2 1 A IT F
2 1 4 2 1 A IT F
3 1 4 2 1 A IT F
4 1 4 2 1 A IT F
.. ... ... ... ... ... ... ...
475 0 3 1 5 A Chemistry S
476 0 3 1 5 A Geology F
477 0 3 1 5 A Geology S
478 0 3 1 5 A History F
479 0 3 1 5 A History S
Relation raisedhands VisITedResources AnnouncementsView Discussion \
0 Father 15 16 2 20
1 Father 20 20 3 25
2 Father 10 7 0 30
3 Father 30 25 5 35
4 Father 40 50 12 50
.. ... ... ... ... ...
475 Father 5 4 5 8
476 Father 50 77 14 28
477 Father 55 74 25 29
478 Father 30 17 14 57
479 Father 35 14 23 62
ParentAnsweringSurvey ParentschoolSatisfaction StudentAbsenceDays Class
0 Yes Good Under-7 M
1 Yes Good Under-7 M
2 No Bad Above-7 L
3 No Bad Above-7 L
4 No Bad Above-7 M
.. ... ... ... ...
475 No Bad Above-7 L
476 No Bad Under-7 M
477 No Bad Under-7 M
478 No Bad Above-7 L
479 No Bad Above-7 L
[480 rows x 16 columns]
gender NationalITy StageID GradeID SectionID Topic Semester \
0 1 4 2 1 0 IT F
1 1 4 2 1 0 IT F
2 1 4 2 1 0 IT F
3 1 4 2 1 0 IT F
4 1 4 2 1 0 IT F
.. ... ... ... ... ... ... ...
475 0 3 1 5 0 Chemistry S
476 0 3 1 5 0 Geology F
477 0 3 1 5 0 Geology S
478 0 3 1 5 0 History F
479 0 3 1 5 0 History S
Relation raisedhands VisITedResources AnnouncementsView Discussion \
0 Father 15 16 2 20
1 Father 20 20 3 25
2 Father 10 7 0 30
3 Father 30 25 5 35
4 Father 40 50 12 50
.. ... ... ... ... ...
475 Father 5 4 5 8
476 Father 50 77 14 28
477 Father 55 74 25 29
478 Father 30 17 14 57
479 Father 35 14 23 62
ParentAnsweringSurvey ParentschoolSatisfaction StudentAbsenceDays Class
0 Yes Good Under-7 M
1 Yes Good Under-7 M
2 No Bad Above-7 L
3 No Bad Above-7 L
4 No Bad Above-7 M
.. ... ... ... ...
475 No Bad Above-7 L
476 No Bad Under-7 M
477 No Bad Under-7 M
478 No Bad Above-7 L
479 No Bad Above-7 L
[480 rows x 16 columns]
gender NationalITy StageID GradeID SectionID Topic Semester \
0 1 4 2 1 0 7 F
1 1 4 2 1 0 7 F
2 1 4 2 1 0 7 F
3 1 4 2 1 0 7 F
4 1 4 2 1 0 7 F
.. ... ... ... ... ... ... ...
475 0 3 1 5 0 2 S
476 0 3 1 5 0 5 F
477 0 3 1 5 0 5 S
478 0 3 1 5 0 6 F
479 0 3 1 5 0 6 S
Relation raisedhands VisITedResources AnnouncementsView Discussion \
0 Father 15 16 2 20
1 Father 20 20 3 25
2 Father 10 7 0 30
3 Father 30 25 5 35
4 Father 40 50 12 50
.. ... ... ... ... ...
475 Father 5 4 5 8
476 Father 50 77 14 28
477 Father 55 74 25 29
478 Father 30 17 14 57
479 Father 35 14 23 62
ParentAnsweringSurvey ParentschoolSatisfaction StudentAbsenceDays Class
0 Yes Good Under-7 M
1 Yes Good Under-7 M
2 No Bad Above-7 L
3 No Bad Above-7 L
4 No Bad Above-7 M
.. ... ... ... ...
475 No Bad Above-7 L
476 No Bad Under-7 M
477 No Bad Under-7 M
478 No Bad Above-7 L
479 No Bad Above-7 L
[480 rows x 16 columns]
gender NationalITy StageID GradeID SectionID Topic Semester \
0 1 4 2 1 0 7 0
1 1 4 2 1 0 7 0
2 1 4 2 1 0 7 0
3 1 4 2 1 0 7 0
4 1 4 2 1 0 7 0
.. ... ... ... ... ... ... ...
475 0 3 1 5 0 2 1
476 0 3 1 5 0 5 0
477 0 3 1 5 0 5 1
478 0 3 1 5 0 6 0
479 0 3 1 5 0 6 1
Relation raisedhands VisITedResources AnnouncementsView Discussion \
0 Father 15 16 2 20
1 Father 20 20 3 25
2 Father 10 7 0 30
3 Father 30 25 5 35
4 Father 40 50 12 50
.. ... ... ... ... ...
475 Father 5 4 5 8
476 Father 50 77 14 28
477 Father 55 74 25 29
478 Father 30 17 14 57
479 Father 35 14 23 62
ParentAnsweringSurvey ParentschoolSatisfaction StudentAbsenceDays Class
0 Yes Good Under-7 M
1 Yes Good Under-7 M
2 No Bad Above-7 L
3 No Bad Above-7 L
4 No Bad Above-7 M
.. ... ... ... ...
475 No Bad Above-7 L
476 No Bad Under-7 M
477 No Bad Under-7 M
478 No Bad Above-7 L
479 No Bad Above-7 L
[480 rows x 16 columns]
gender NationalITy StageID GradeID SectionID Topic Semester \
0 1 4 2 1 0 7 0
1 1 4 2 1 0 7 0
2 1 4 2 1 0 7 0
3 1 4 2 1 0 7 0
4 1 4 2 1 0 7 0
.. ... ... ... ... ... ... ...
475 0 3 1 5 0 2 1
476 0 3 1 5 0 5 0
477 0 3 1 5 0 5 1
478 0 3 1 5 0 6 0
479 0 3 1 5 0 6 1
Relation raisedhands VisITedResources AnnouncementsView Discussion \
0 0 15 16 2 20
1 0 20 20 3 25
2 0 10 7 0 30
3 0 30 25 5 35
4 0 40 50 12 50
.. ... ... ... ... ...
475 0 5 4 5 8
476 0 50 77 14 28
477 0 55 74 25 29
478 0 30 17 14 57
479 0 35 14 23 62
ParentAnsweringSurvey ParentschoolSatisfaction StudentAbsenceDays Class
0 Yes Good Under-7 M
1 Yes Good Under-7 M
2 No Bad Above-7 L
3 No Bad Above-7 L
4 No Bad Above-7 M
.. ... ... ... ...
475 No Bad Above-7 L
476 No Bad Under-7 M
477 No Bad Under-7 M
478 No Bad Above-7 L
479 No Bad Above-7 L
[480 rows x 16 columns]
gender NationalITy StageID GradeID SectionID Topic Semester \
0 1 4 2 1 0 7 0
1 1 4 2 1 0 7 0
2 1 4 2 1 0 7 0
3 1 4 2 1 0 7 0
4 1 4 2 1 0 7 0
.. ... ... ... ... ... ... ...
475 0 3 1 5 0 2 1
476 0 3 1 5 0 5 0
477 0 3 1 5 0 5 1
478 0 3 1 5 0 6 0
479 0 3 1 5 0 6 1
Relation raisedhands VisITedResources AnnouncementsView Discussion \
0 0 15 16 2 20
1 0 20 20 3 25
2 0 10 7 0 30
3 0 30 25 5 35
4 0 40 50 12 50
.. ... ... ... ... ...
475 0 5 4 5 8
476 0 50 77 14 28
477 0 55 74 25 29
478 0 30 17 14 57
479 0 35 14 23 62
ParentAnsweringSurvey ParentschoolSatisfaction StudentAbsenceDays Class
0 1 Good Under-7 M
1 1 Good Under-7 M
2 0 Bad Above-7 L
3 0 Bad Above-7 L
4 0 Bad Above-7 M
.. ... ... ... ...
475 0 Bad Above-7 L
476 0 Bad Under-7 M
477 0 Bad Under-7 M
478 0 Bad Above-7 L
479 0 Bad Above-7 L
[480 rows x 16 columns]
gender NationalITy StageID GradeID SectionID Topic Semester \
0 1 4 2 1 0 7 0
1 1 4 2 1 0 7 0
2 1 4 2 1 0 7 0
3 1 4 2 1 0 7 0
4 1 4 2 1 0 7 0
.. ... ... ... ... ... ... ...
475 0 3 1 5 0 2 1
476 0 3 1 5 0 5 0
477 0 3 1 5 0 5 1
478 0 3 1 5 0 6 0
479 0 3 1 5 0 6 1
Relation raisedhands VisITedResources AnnouncementsView Discussion \
0 0 15 16 2 20
1 0 20 20 3 25
2 0 10 7 0 30
3 0 30 25 5 35
4 0 40 50 12 50
.. ... ... ... ... ...
475 0 5 4 5 8
476 0 50 77 14 28
477 0 55 74 25 29
478 0 30 17 14 57
479 0 35 14 23 62
ParentAnsweringSurvey ParentschoolSatisfaction StudentAbsenceDays Class
0 1 1 Under-7 M
1 1 1 Under-7 M
2 0 0 Above-7 L
3 0 0 Above-7 L
4 0 0 Above-7 M
.. ... ... ... ...
475 0 0 Above-7 L
476 0 0 Under-7 M
477 0 0 Under-7 M
478 0 0 Above-7 L
479 0 0 Above-7 L
[480 rows x 16 columns]
gender NationalITy StageID GradeID SectionID Topic Semester \
0 1 4 2 1 0 7 0
1 1 4 2 1 0 7 0
2 1 4 2 1 0 7 0
3 1 4 2 1 0 7 0
4 1 4 2 1 0 7 0
.. ... ... ... ... ... ... ...
475 0 3 1 5 0 2 1
476 0 3 1 5 0 5 0
477 0 3 1 5 0 5 1
478 0 3 1 5 0 6 0
479 0 3 1 5 0 6 1
Relation raisedhands VisITedResources AnnouncementsView Discussion \
0 0 15 16 2 20
1 0 20 20 3 25
2 0 10 7 0 30
3 0 30 25 5 35
4 0 40 50 12 50
.. ... ... ... ... ...
475 0 5 4 5 8
476 0 50 77 14 28
477 0 55 74 25 29
478 0 30 17 14 57
479 0 35 14 23 62
ParentAnsweringSurvey ParentschoolSatisfaction StudentAbsenceDays Class
0 1 1 1 M
1 1 1 1 M
2 0 0 0 L
3 0 0 0 L
4 0 0 0 M
.. ... ... ... ...
475 0 0 0 L
476 0 0 1 M
477 0 0 1 M
478 0 0 0 L
479 0 0 0 L
[480 rows x 16 columns]
gender NationalITy StageID GradeID SectionID Topic Semester \
0 1 4 2 1 0 7 0
1 1 4 2 1 0 7 0
2 1 4 2 1 0 7 0
3 1 4 2 1 0 7 0
4 1 4 2 1 0 7 0
.. ... ... ... ... ... ... ...
475 0 3 1 5 0 2 1
476 0 3 1 5 0 5 0
477 0 3 1 5 0 5 1
478 0 3 1 5 0 6 0
479 0 3 1 5 0 6 1
Relation raisedhands VisITedResources AnnouncementsView Discussion \
0 0 15 16 2 20
1 0 20 20 3 25
2 0 10 7 0 30
3 0 30 25 5 35
4 0 40 50 12 50
.. ... ... ... ... ...
475 0 5 4 5 8
476 0 50 77 14 28
477 0 55 74 25 29
478 0 30 17 14 57
479 0 35 14 23 62
ParentAnsweringSurvey ParentschoolSatisfaction StudentAbsenceDays \
0 1 1 1
1 1 1 1
2 0 0 0
3 0 0 0
4 0 0 0
.. ... ... ...
475 0 0 0
476 0 0 1
477 0 0 1
478 0 0 0
479 0 0 0
Class
0 2
1 2
2 1
3 1
4 2
.. ...
475 1
476 2
477 2
478 1
479 1
[480 rows x 16 columns]
from sklearn.preprocessing import LabelEncoder
Features = data.drop('StageID',axis=1)
Target = data['StageID']
label = LabelEncoder()
Cat_colums = Features.dtypes.pipe(lambda Feature: Feature[Feature=='object']).index
for col in Cat_colums:
Features[col]=label.fit_transform(Features[col])
print(Features)
gender NationalITy PlaceofBirth GradeID SectionID Topic Semester \
0 1 KW KuwaIT G-04 A IT F
1 1 KW KuwaIT G-04 A IT F
2 1 KW KuwaIT G-04 A IT F
3 1 KW KuwaIT G-04 A IT F
4 1 KW KuwaIT G-04 A IT F
.. ... ... ... ... ... ... ...
475 0 Jordan Jordan G-08 A Chemistry S
476 0 Jordan Jordan G-08 A Geology F
477 0 Jordan Jordan G-08 A Geology S
478 0 Jordan Jordan G-08 A History F
479 0 Jordan Jordan G-08 A History S
Relation raisedhands VisITedResources AnnouncementsView Discussion \
0 Father 15 16 2 20
1 Father 20 20 3 25
2 Father 10 7 0 30
3 Father 30 25 5 35
4 Father 40 50 12 50
.. ... ... ... ... ...
475 Father 5 4 5 8
476 Father 50 77 14 28
477 Father 55 74 25 29
478 Father 30 17 14 57
479 Father 35 14 23 62
ParentAnsweringSurvey ParentschoolSatisfaction StudentAbsenceDays Class
0 Yes Good Under-7 M
1 Yes Good Under-7 M
2 No Bad Above-7 L
3 No Bad Above-7 L
4 No Bad Above-7 M
.. ... ... ... ...
475 No Bad Above-7 L
476 No Bad Under-7 M
477 No Bad Under-7 M
478 No Bad Above-7 L
479 No Bad Above-7 L
[480 rows x 16 columns]
gender NationalITy PlaceofBirth GradeID SectionID Topic Semester \
0 1 4 KuwaIT G-04 A IT F
1 1 4 KuwaIT G-04 A IT F
2 1 4 KuwaIT G-04 A IT F
3 1 4 KuwaIT G-04 A IT F
4 1 4 KuwaIT G-04 A IT F
.. ... ... ... ... ... ... ...
475 0 3 Jordan G-08 A Chemistry S
476 0 3 Jordan G-08 A Geology F
477 0 3 Jordan G-08 A Geology S
478 0 3 Jordan G-08 A History F
479 0 3 Jordan G-08 A History S
Relation raisedhands VisITedResources AnnouncementsView Discussion \
0 Father 15 16 2 20
1 Father 20 20 3 25
2 Father 10 7 0 30
3 Father 30 25 5 35
4 Father 40 50 12 50
.. ... ... ... ... ...
475 Father 5 4 5 8
476 Father 50 77 14 28
477 Father 55 74 25 29
478 Father 30 17 14 57
479 Father 35 14 23 62
ParentAnsweringSurvey ParentschoolSatisfaction StudentAbsenceDays Class
0 Yes Good Under-7 M
1 Yes Good Under-7 M
2 No Bad Above-7 L
3 No Bad Above-7 L
4 No Bad Above-7 M
.. ... ... ... ...
475 No Bad Above-7 L
476 No Bad Under-7 M
477 No Bad Under-7 M
478 No Bad Above-7 L
479 No Bad Above-7 L
[480 rows x 16 columns]
gender NationalITy PlaceofBirth GradeID SectionID Topic Semester \
0 1 4 4 G-04 A IT F
1 1 4 4 G-04 A IT F
2 1 4 4 G-04 A IT F
3 1 4 4 G-04 A IT F
4 1 4 4 G-04 A IT F
.. ... ... ... ... ... ... ...
475 0 3 3 G-08 A Chemistry S
476 0 3 3 G-08 A Geology F
477 0 3 3 G-08 A Geology S
478 0 3 3 G-08 A History F
479 0 3 3 G-08 A History S
Relation raisedhands VisITedResources AnnouncementsView Discussion \
0 Father 15 16 2 20
1 Father 20 20 3 25
2 Father 10 7 0 30
3 Father 30 25 5 35
4 Father 40 50 12 50
.. ... ... ... ... ...
475 Father 5 4 5 8
476 Father 50 77 14 28
477 Father 55 74 25 29
478 Father 30 17 14 57
479 Father 35 14 23 62
ParentAnsweringSurvey ParentschoolSatisfaction StudentAbsenceDays Class
0 Yes Good Under-7 M
1 Yes Good Under-7 M
2 No Bad Above-7 L
3 No Bad Above-7 L
4 No Bad Above-7 M
.. ... ... ... ...
475 No Bad Above-7 L
476 No Bad Under-7 M
477 No Bad Under-7 M
478 No Bad Above-7 L
479 No Bad Above-7 L
[480 rows x 16 columns]
gender NationalITy PlaceofBirth GradeID SectionID Topic Semester \
0 1 4 4 1 A IT F
1 1 4 4 1 A IT F
2 1 4 4 1 A IT F
3 1 4 4 1 A IT F
4 1 4 4 1 A IT F
.. ... ... ... ... ... ... ...
475 0 3 3 5 A Chemistry S
476 0 3 3 5 A Geology F
477 0 3 3 5 A Geology S
478 0 3 3 5 A History F
479 0 3 3 5 A History S
Relation raisedhands VisITedResources AnnouncementsView Discussion \
0 Father 15 16 2 20
1 Father 20 20 3 25
2 Father 10 7 0 30
3 Father 30 25 5 35
4 Father 40 50 12 50
.. ... ... ... ... ...
475 Father 5 4 5 8
476 Father 50 77 14 28
477 Father 55 74 25 29
478 Father 30 17 14 57
479 Father 35 14 23 62
ParentAnsweringSurvey ParentschoolSatisfaction StudentAbsenceDays Class
0 Yes Good Under-7 M
1 Yes Good Under-7 M
2 No Bad Above-7 L
3 No Bad Above-7 L
4 No Bad Above-7 M
.. ... ... ... ...
475 No Bad Above-7 L
476 No Bad Under-7 M
477 No Bad Under-7 M
478 No Bad Above-7 L
479 No Bad Above-7 L
[480 rows x 16 columns]
gender NationalITy PlaceofBirth GradeID SectionID Topic \
0 1 4 4 1 0 IT
1 1 4 4 1 0 IT
2 1 4 4 1 0 IT
3 1 4 4 1 0 IT
4 1 4 4 1 0 IT
.. ... ... ... ... ... ...
475 0 3 3 5 0 Chemistry
476 0 3 3 5 0 Geology
477 0 3 3 5 0 Geology
478 0 3 3 5 0 History
479 0 3 3 5 0 History
Semester Relation raisedhands VisITedResources AnnouncementsView \
0 F Father 15 16 2
1 F Father 20 20 3
2 F Father 10 7 0
3 F Father 30 25 5
4 F Father 40 50 12
.. ... ... ... ... ...
475 S Father 5 4 5
476 F Father 50 77 14
477 S Father 55 74 25
478 F Father 30 17 14
479 S Father 35 14 23
Discussion ParentAnsweringSurvey ParentschoolSatisfaction \
0 20 Yes Good
1 25 Yes Good
2 30 No Bad
3 35 No Bad
4 50 No Bad
.. ... ... ...
475 8 No Bad
476 28 No Bad
477 29 No Bad
478 57 No Bad
479 62 No Bad
StudentAbsenceDays Class
0 Under-7 M
1 Under-7 M
2 Above-7 L
3 Above-7 L
4 Above-7 M
.. ... ...
475 Above-7 L
476 Under-7 M
477 Under-7 M
478 Above-7 L
479 Above-7 L
[480 rows x 16 columns]
gender NationalITy PlaceofBirth GradeID SectionID Topic Semester \
0 1 4 4 1 0 7 F
1 1 4 4 1 0 7 F
2 1 4 4 1 0 7 F
3 1 4 4 1 0 7 F
4 1 4 4 1 0 7 F
.. ... ... ... ... ... ... ...
475 0 3 3 5 0 2 S
476 0 3 3 5 0 5 F
477 0 3 3 5 0 5 S
478 0 3 3 5 0 6 F
479 0 3 3 5 0 6 S
Relation raisedhands VisITedResources AnnouncementsView Discussion \
0 Father 15 16 2 20
1 Father 20 20 3 25
2 Father 10 7 0 30
3 Father 30 25 5 35
4 Father 40 50 12 50
.. ... ... ... ... ...
475 Father 5 4 5 8
476 Father 50 77 14 28
477 Father 55 74 25 29
478 Father 30 17 14 57
479 Father 35 14 23 62
ParentAnsweringSurvey ParentschoolSatisfaction StudentAbsenceDays Class
0 Yes Good Under-7 M
1 Yes Good Under-7 M
2 No Bad Above-7 L
3 No Bad Above-7 L
4 No Bad Above-7 M
.. ... ... ... ...
475 No Bad Above-7 L
476 No Bad Under-7 M
477 No Bad Under-7 M
478 No Bad Above-7 L
479 No Bad Above-7 L
[480 rows x 16 columns]
gender NationalITy PlaceofBirth GradeID SectionID Topic Semester \
0 1 4 4 1 0 7 0
1 1 4 4 1 0 7 0
2 1 4 4 1 0 7 0
3 1 4 4 1 0 7 0
4 1 4 4 1 0 7 0
.. ... ... ... ... ... ... ...
475 0 3 3 5 0 2 1
476 0 3 3 5 0 5 0
477 0 3 3 5 0 5 1
478 0 3 3 5 0 6 0
479 0 3 3 5 0 6 1
Relation raisedhands VisITedResources AnnouncementsView Discussion \
0 Father 15 16 2 20
1 Father 20 20 3 25
2 Father 10 7 0 30
3 Father 30 25 5 35
4 Father 40 50 12 50
.. ... ... ... ... ...
475 Father 5 4 5 8
476 Father 50 77 14 28
477 Father 55 74 25 29
478 Father 30 17 14 57
479 Father 35 14 23 62
ParentAnsweringSurvey ParentschoolSatisfaction StudentAbsenceDays Class
0 Yes Good Under-7 M
1 Yes Good Under-7 M
2 No Bad Above-7 L
3 No Bad Above-7 L
4 No Bad Above-7 M
.. ... ... ... ...
475 No Bad Above-7 L
476 No Bad Under-7 M
477 No Bad Under-7 M
478 No Bad Above-7 L
479 No Bad Above-7 L
[480 rows x 16 columns]
gender NationalITy PlaceofBirth GradeID SectionID Topic Semester \
0 1 4 4 1 0 7 0
1 1 4 4 1 0 7 0
2 1 4 4 1 0 7 0
3 1 4 4 1 0 7 0
4 1 4 4 1 0 7 0
.. ... ... ... ... ... ... ...
475 0 3 3 5 0 2 1
476 0 3 3 5 0 5 0
477 0 3 3 5 0 5 1
478 0 3 3 5 0 6 0
479 0 3 3 5 0 6 1
Relation raisedhands VisITedResources AnnouncementsView Discussion \
0 0 15 16 2 20
1 0 20 20 3 25
2 0 10 7 0 30
3 0 30 25 5 35
4 0 40 50 12 50
.. ... ... ... ... ...
475 0 5 4 5 8
476 0 50 77 14 28
477 0 55 74 25 29
478 0 30 17 14 57
479 0 35 14 23 62
ParentAnsweringSurvey ParentschoolSatisfaction StudentAbsenceDays Class
0 Yes Good Under-7 M
1 Yes Good Under-7 M
2 No Bad Above-7 L
3 No Bad Above-7 L
4 No Bad Above-7 M
.. ... ... ... ...
475 No Bad Above-7 L
476 No Bad Under-7 M
477 No Bad Under-7 M
478 No Bad Above-7 L
479 No Bad Above-7 L
[480 rows x 16 columns]
gender NationalITy PlaceofBirth GradeID SectionID Topic Semester \
0 1 4 4 1 0 7 0
1 1 4 4 1 0 7 0
2 1 4 4 1 0 7 0
3 1 4 4 1 0 7 0
4 1 4 4 1 0 7 0
.. ... ... ... ... ... ... ...
475 0 3 3 5 0 2 1
476 0 3 3 5 0 5 0
477 0 3 3 5 0 5 1
478 0 3 3 5 0 6 0
479 0 3 3 5 0 6 1
Relation raisedhands VisITedResources AnnouncementsView Discussion \
0 0 15 16 2 20
1 0 20 20 3 25
2 0 10 7 0 30
3 0 30 25 5 35
4 0 40 50 12 50
.. ... ... ... ... ...
475 0 5 4 5 8
476 0 50 77 14 28
477 0 55 74 25 29
478 0 30 17 14 57
479 0 35 14 23 62
ParentAnsweringSurvey ParentschoolSatisfaction StudentAbsenceDays Class
0 1 Good Under-7 M
1 1 Good Under-7 M
2 0 Bad Above-7 L
3 0 Bad Above-7 L
4 0 Bad Above-7 M
.. ... ... ... ...
475 0 Bad Above-7 L
476 0 Bad Under-7 M
477 0 Bad Under-7 M
478 0 Bad Above-7 L
479 0 Bad Above-7 L
[480 rows x 16 columns]
gender NationalITy PlaceofBirth GradeID SectionID Topic Semester \
0 1 4 4 1 0 7 0
1 1 4 4 1 0 7 0
2 1 4 4 1 0 7 0
3 1 4 4 1 0 7 0
4 1 4 4 1 0 7 0
.. ... ... ... ... ... ... ...
475 0 3 3 5 0 2 1
476 0 3 3 5 0 5 0
477 0 3 3 5 0 5 1
478 0 3 3 5 0 6 0
479 0 3 3 5 0 6 1
Relation raisedhands VisITedResources AnnouncementsView Discussion \
0 0 15 16 2 20
1 0 20 20 3 25
2 0 10 7 0 30
3 0 30 25 5 35
4 0 40 50 12 50
.. ... ... ... ... ...
475 0 5 4 5 8
476 0 50 77 14 28
477 0 55 74 25 29
478 0 30 17 14 57
479 0 35 14 23 62
ParentAnsweringSurvey ParentschoolSatisfaction StudentAbsenceDays Class
0 1 1 Under-7 M
1 1 1 Under-7 M
2 0 0 Above-7 L
3 0 0 Above-7 L
4 0 0 Above-7 M
.. ... ... ... ...
475 0 0 Above-7 L
476 0 0 Under-7 M
477 0 0 Under-7 M
478 0 0 Above-7 L
479 0 0 Above-7 L
[480 rows x 16 columns]
gender NationalITy PlaceofBirth GradeID SectionID Topic Semester \
0 1 4 4 1 0 7 0
1 1 4 4 1 0 7 0
2 1 4 4 1 0 7 0
3 1 4 4 1 0 7 0
4 1 4 4 1 0 7 0
.. ... ... ... ... ... ... ...
475 0 3 3 5 0 2 1
476 0 3 3 5 0 5 0
477 0 3 3 5 0 5 1
478 0 3 3 5 0 6 0
479 0 3 3 5 0 6 1
Relation raisedhands VisITedResources AnnouncementsView Discussion \
0 0 15 16 2 20
1 0 20 20 3 25
2 0 10 7 0 30
3 0 30 25 5 35
4 0 40 50 12 50
.. ... ... ... ... ...
475 0 5 4 5 8
476 0 50 77 14 28
477 0 55 74 25 29
478 0 30 17 14 57
479 0 35 14 23 62
ParentAnsweringSurvey ParentschoolSatisfaction StudentAbsenceDays Class
0 1 1 1 M
1 1 1 1 M
2 0 0 0 L
3 0 0 0 L
4 0 0 0 M
.. ... ... ... ...
475 0 0 0 L
476 0 0 1 M
477 0 0 1 M
478 0 0 0 L
479 0 0 0 L
[480 rows x 16 columns]
gender NationalITy PlaceofBirth GradeID SectionID Topic Semester \
0 1 4 4 1 0 7 0
1 1 4 4 1 0 7 0
2 1 4 4 1 0 7 0
3 1 4 4 1 0 7 0
4 1 4 4 1 0 7 0
.. ... ... ... ... ... ... ...
475 0 3 3 5 0 2 1
476 0 3 3 5 0 5 0
477 0 3 3 5 0 5 1
478 0 3 3 5 0 6 0
479 0 3 3 5 0 6 1
Relation raisedhands VisITedResources AnnouncementsView Discussion \
0 0 15 16 2 20
1 0 20 20 3 25
2 0 10 7 0 30
3 0 30 25 5 35
4 0 40 50 12 50
.. ... ... ... ... ...
475 0 5 4 5 8
476 0 50 77 14 28
477 0 55 74 25 29
478 0 30 17 14 57
479 0 35 14 23 62
ParentAnsweringSurvey ParentschoolSatisfaction StudentAbsenceDays \
0 1 1 1
1 1 1 1
2 0 0 0
3 0 0 0
4 0 0 0
.. ... ... ...
475 0 0 0
476 0 0 1
477 0 0 1
478 0 0 0
479 0 0 0
Class
0 2
1 2
2 1
3 1
4 2
.. ...
475 1
476 2
477 2
478 1
479 1
[480 rows x 16 columns]
from sklearn.preprocessing import LabelEncoder
Features = data.drop('GradeID',axis=1)
Target = data['GradeID']
label = LabelEncoder()
Cat_colums = Features.dtypes.pipe(lambda Feature: Feature[Feature=='object']).index
for col in Cat_colums:
Features[col]=label.fit_transform(Features[col])
print(Features)
gender NationalITy PlaceofBirth StageID SectionID Topic \
0 1 KW KuwaIT lowerlevel A IT
1 1 KW KuwaIT lowerlevel A IT
2 1 KW KuwaIT lowerlevel A IT
3 1 KW KuwaIT lowerlevel A IT
4 1 KW KuwaIT lowerlevel A IT
.. ... ... ... ... ... ...
475 0 Jordan Jordan MiddleSchool A Chemistry
476 0 Jordan Jordan MiddleSchool A Geology
477 0 Jordan Jordan MiddleSchool A Geology
478 0 Jordan Jordan MiddleSchool A History
479 0 Jordan Jordan MiddleSchool A History
Semester Relation raisedhands VisITedResources AnnouncementsView \
0 F Father 15 16 2
1 F Father 20 20 3
2 F Father 10 7 0
3 F Father 30 25 5
4 F Father 40 50 12
.. ... ... ... ... ...
475 S Father 5 4 5
476 F Father 50 77 14
477 S Father 55 74 25
478 F Father 30 17 14
479 S Father 35 14 23
Discussion ParentAnsweringSurvey ParentschoolSatisfaction \
0 20 Yes Good
1 25 Yes Good
2 30 No Bad
3 35 No Bad
4 50 No Bad
.. ... ... ...
475 8 No Bad
476 28 No Bad
477 29 No Bad
478 57 No Bad
479 62 No Bad
StudentAbsenceDays Class
0 Under-7 M
1 Under-7 M
2 Above-7 L
3 Above-7 L
4 Above-7 M
.. ... ...
475 Above-7 L
476 Under-7 M
477 Under-7 M
478 Above-7 L
479 Above-7 L
[480 rows x 16 columns]
gender NationalITy PlaceofBirth StageID SectionID Topic \
0 1 4 KuwaIT lowerlevel A IT
1 1 4 KuwaIT lowerlevel A IT
2 1 4 KuwaIT lowerlevel A IT
3 1 4 KuwaIT lowerlevel A IT
4 1 4 KuwaIT lowerlevel A IT
.. ... ... ... ... ... ...
475 0 3 Jordan MiddleSchool A Chemistry
476 0 3 Jordan MiddleSchool A Geology
477 0 3 Jordan MiddleSchool A Geology
478 0 3 Jordan MiddleSchool A History
479 0 3 Jordan MiddleSchool A History
Semester Relation raisedhands VisITedResources AnnouncementsView \
0 F Father 15 16 2
1 F Father 20 20 3
2 F Father 10 7 0
3 F Father 30 25 5
4 F Father 40 50 12
.. ... ... ... ... ...
475 S Father 5 4 5
476 F Father 50 77 14
477 S Father 55 74 25
478 F Father 30 17 14
479 S Father 35 14 23
Discussion ParentAnsweringSurvey ParentschoolSatisfaction \
0 20 Yes Good
1 25 Yes Good
2 30 No Bad
3 35 No Bad
4 50 No Bad
.. ... ... ...
475 8 No Bad
476 28 No Bad
477 29 No Bad
478 57 No Bad
479 62 No Bad
StudentAbsenceDays Class
0 Under-7 M
1 Under-7 M
2 Above-7 L
3 Above-7 L
4 Above-7 M
.. ... ...
475 Above-7 L
476 Under-7 M
477 Under-7 M
478 Above-7 L
479 Above-7 L
[480 rows x 16 columns]
gender NationalITy PlaceofBirth StageID SectionID Topic \
0 1 4 4 lowerlevel A IT
1 1 4 4 lowerlevel A IT
2 1 4 4 lowerlevel A IT
3 1 4 4 lowerlevel A IT
4 1 4 4 lowerlevel A IT
.. ... ... ... ... ... ...
475 0 3 3 MiddleSchool A Chemistry
476 0 3 3 MiddleSchool A Geology
477 0 3 3 MiddleSchool A Geology
478 0 3 3 MiddleSchool A History
479 0 3 3 MiddleSchool A History
Semester Relation raisedhands VisITedResources AnnouncementsView \
0 F Father 15 16 2
1 F Father 20 20 3
2 F Father 10 7 0
3 F Father 30 25 5
4 F Father 40 50 12
.. ... ... ... ... ...
475 S Father 5 4 5
476 F Father 50 77 14
477 S Father 55 74 25
478 F Father 30 17 14
479 S Father 35 14 23
Discussion ParentAnsweringSurvey ParentschoolSatisfaction \
0 20 Yes Good
1 25 Yes Good
2 30 No Bad
3 35 No Bad
4 50 No Bad
.. ... ... ...
475 8 No Bad
476 28 No Bad
477 29 No Bad
478 57 No Bad
479 62 No Bad
StudentAbsenceDays Class
0 Under-7 M
1 Under-7 M
2 Above-7 L
3 Above-7 L
4 Above-7 M
.. ... ...
475 Above-7 L
476 Under-7 M
477 Under-7 M
478 Above-7 L
479 Above-7 L
[480 rows x 16 columns]
gender NationalITy PlaceofBirth StageID SectionID Topic Semester \
0 1 4 4 2 A IT F
1 1 4 4 2 A IT F
2 1 4 4 2 A IT F
3 1 4 4 2 A IT F
4 1 4 4 2 A IT F
.. ... ... ... ... ... ... ...
475 0 3 3 1 A Chemistry S
476 0 3 3 1 A Geology F
477 0 3 3 1 A Geology S
478 0 3 3 1 A History F
479 0 3 3 1 A History S
Relation raisedhands VisITedResources AnnouncementsView Discussion \
0 Father 15 16 2 20
1 Father 20 20 3 25
2 Father 10 7 0 30
3 Father 30 25 5 35
4 Father 40 50 12 50
.. ... ... ... ... ...
475 Father 5 4 5 8
476 Father 50 77 14 28
477 Father 55 74 25 29
478 Father 30 17 14 57
479 Father 35 14 23 62
ParentAnsweringSurvey ParentschoolSatisfaction StudentAbsenceDays Class
0 Yes Good Under-7 M
1 Yes Good Under-7 M
2 No Bad Above-7 L
3 No Bad Above-7 L
4 No Bad Above-7 M
.. ... ... ... ...
475 No Bad Above-7 L
476 No Bad Under-7 M
477 No Bad Under-7 M
478 No Bad Above-7 L
479 No Bad Above-7 L
[480 rows x 16 columns]
gender NationalITy PlaceofBirth StageID SectionID Topic \
0 1 4 4 2 0 IT
1 1 4 4 2 0 IT
2 1 4 4 2 0 IT
3 1 4 4 2 0 IT
4 1 4 4 2 0 IT
.. ... ... ... ... ... ...
475 0 3 3 1 0 Chemistry
476 0 3 3 1 0 Geology
477 0 3 3 1 0 Geology
478 0 3 3 1 0 History
479 0 3 3 1 0 History
Semester Relation raisedhands VisITedResources AnnouncementsView \
0 F Father 15 16 2
1 F Father 20 20 3
2 F Father 10 7 0
3 F Father 30 25 5
4 F Father 40 50 12
.. ... ... ... ... ...
475 S Father 5 4 5
476 F Father 50 77 14
477 S Father 55 74 25
478 F Father 30 17 14
479 S Father 35 14 23
Discussion ParentAnsweringSurvey ParentschoolSatisfaction \
0 20 Yes Good
1 25 Yes Good
2 30 No Bad
3 35 No Bad
4 50 No Bad
.. ... ... ...
475 8 No Bad
476 28 No Bad
477 29 No Bad
478 57 No Bad
479 62 No Bad
StudentAbsenceDays Class
0 Under-7 M
1 Under-7 M
2 Above-7 L
3 Above-7 L
4 Above-7 M
.. ... ...
475 Above-7 L
476 Under-7 M
477 Under-7 M
478 Above-7 L
479 Above-7 L
[480 rows x 16 columns]
gender NationalITy PlaceofBirth StageID SectionID Topic Semester \
0 1 4 4 2 0 7 F
1 1 4 4 2 0 7 F
2 1 4 4 2 0 7 F
3 1 4 4 2 0 7 F
4 1 4 4 2 0 7 F
.. ... ... ... ... ... ... ...
475 0 3 3 1 0 2 S
476 0 3 3 1 0 5 F
477 0 3 3 1 0 5 S
478 0 3 3 1 0 6 F
479 0 3 3 1 0 6 S
Relation raisedhands VisITedResources AnnouncementsView Discussion \
0 Father 15 16 2 20
1 Father 20 20 3 25
2 Father 10 7 0 30
3 Father 30 25 5 35
4 Father 40 50 12 50
.. ... ... ... ... ...
475 Father 5 4 5 8
476 Father 50 77 14 28
477 Father 55 74 25 29
478 Father 30 17 14 57
479 Father 35 14 23 62
ParentAnsweringSurvey ParentschoolSatisfaction StudentAbsenceDays Class
0 Yes Good Under-7 M
1 Yes Good Under-7 M
2 No Bad Above-7 L
3 No Bad Above-7 L
4 No Bad Above-7 M
.. ... ... ... ...
475 No Bad Above-7 L
476 No Bad Under-7 M
477 No Bad Under-7 M
478 No Bad Above-7 L
479 No Bad Above-7 L
[480 rows x 16 columns]
gender NationalITy PlaceofBirth StageID SectionID Topic Semester \
0 1 4 4 2 0 7 0
1 1 4 4 2 0 7 0
2 1 4 4 2 0 7 0
3 1 4 4 2 0 7 0
4 1 4 4 2 0 7 0
.. ... ... ... ... ... ... ...
475 0 3 3 1 0 2 1
476 0 3 3 1 0 5 0
477 0 3 3 1 0 5 1
478 0 3 3 1 0 6 0
479 0 3 3 1 0 6 1
Relation raisedhands VisITedResources AnnouncementsView Discussion \
0 Father 15 16 2 20
1 Father 20 20 3 25
2 Father 10 7 0 30
3 Father 30 25 5 35
4 Father 40 50 12 50
.. ... ... ... ... ...
475 Father 5 4 5 8
476 Father 50 77 14 28
477 Father 55 74 25 29
478 Father 30 17 14 57
479 Father 35 14 23 62
ParentAnsweringSurvey ParentschoolSatisfaction StudentAbsenceDays Class
0 Yes Good Under-7 M
1 Yes Good Under-7 M
2 No Bad Above-7 L
3 No Bad Above-7 L
4 No Bad Above-7 M
.. ... ... ... ...
475 No Bad Above-7 L
476 No Bad Under-7 M
477 No Bad Under-7 M
478 No Bad Above-7 L
479 No Bad Above-7 L
[480 rows x 16 columns]
gender NationalITy PlaceofBirth StageID SectionID Topic Semester \
0 1 4 4 2 0 7 0
1 1 4 4 2 0 7 0
2 1 4 4 2 0 7 0
3 1 4 4 2 0 7 0
4 1 4 4 2 0 7 0
.. ... ... ... ... ... ... ...
475 0 3 3 1 0 2 1
476 0 3 3 1 0 5 0
477 0 3 3 1 0 5 1
478 0 3 3 1 0 6 0
479 0 3 3 1 0 6 1
Relation raisedhands VisITedResources AnnouncementsView Discussion \
0 0 15 16 2 20
1 0 20 20 3 25
2 0 10 7 0 30
3 0 30 25 5 35
4 0 40 50 12 50
.. ... ... ... ... ...
475 0 5 4 5 8
476 0 50 77 14 28
477 0 55 74 25 29
478 0 30 17 14 57
479 0 35 14 23 62
ParentAnsweringSurvey ParentschoolSatisfaction StudentAbsenceDays Class
0 Yes Good Under-7 M
1 Yes Good Under-7 M
2 No Bad Above-7 L
3 No Bad Above-7 L
4 No Bad Above-7 M
.. ... ... ... ...
475 No Bad Above-7 L
476 No Bad Under-7 M
477 No Bad Under-7 M
478 No Bad Above-7 L
479 No Bad Above-7 L
[480 rows x 16 columns]
gender NationalITy PlaceofBirth StageID SectionID Topic Semester \
0 1 4 4 2 0 7 0
1 1 4 4 2 0 7 0
2 1 4 4 2 0 7 0
3 1 4 4 2 0 7 0
4 1 4 4 2 0 7 0
.. ... ... ... ... ... ... ...
475 0 3 3 1 0 2 1
476 0 3 3 1 0 5 0
477 0 3 3 1 0 5 1
478 0 3 3 1 0 6 0
479 0 3 3 1 0 6 1
Relation raisedhands VisITedResources AnnouncementsView Discussion \
0 0 15 16 2 20
1 0 20 20 3 25
2 0 10 7 0 30
3 0 30 25 5 35
4 0 40 50 12 50
.. ... ... ... ... ...
475 0 5 4 5 8
476 0 50 77 14 28
477 0 55 74 25 29
478 0 30 17 14 57
479 0 35 14 23 62
ParentAnsweringSurvey ParentschoolSatisfaction StudentAbsenceDays Class
0 1 Good Under-7 M
1 1 Good Under-7 M
2 0 Bad Above-7 L
3 0 Bad Above-7 L
4 0 Bad Above-7 M
.. ... ... ... ...
475 0 Bad Above-7 L
476 0 Bad Under-7 M
477 0 Bad Under-7 M
478 0 Bad Above-7 L
479 0 Bad Above-7 L
[480 rows x 16 columns]
gender NationalITy PlaceofBirth StageID SectionID Topic Semester \
0 1 4 4 2 0 7 0
1 1 4 4 2 0 7 0
2 1 4 4 2 0 7 0
3 1 4 4 2 0 7 0
4 1 4 4 2 0 7 0
.. ... ... ... ... ... ... ...
475 0 3 3 1 0 2 1
476 0 3 3 1 0 5 0
477 0 3 3 1 0 5 1
478 0 3 3 1 0 6 0
479 0 3 3 1 0 6 1
Relation raisedhands VisITedResources AnnouncementsView Discussion \
0 0 15 16 2 20
1 0 20 20 3 25
2 0 10 7 0 30
3 0 30 25 5 35
4 0 40 50 12 50
.. ... ... ... ... ...
475 0 5 4 5 8
476 0 50 77 14 28
477 0 55 74 25 29
478 0 30 17 14 57
479 0 35 14 23 62
ParentAnsweringSurvey ParentschoolSatisfaction StudentAbsenceDays Class
0 1 1 Under-7 M
1 1 1 Under-7 M
2 0 0 Above-7 L
3 0 0 Above-7 L
4 0 0 Above-7 M
.. ... ... ... ...
475 0 0 Above-7 L
476 0 0 Under-7 M
477 0 0 Under-7 M
478 0 0 Above-7 L
479 0 0 Above-7 L
[480 rows x 16 columns]
gender NationalITy PlaceofBirth StageID SectionID Topic Semester \
0 1 4 4 2 0 7 0
1 1 4 4 2 0 7 0
2 1 4 4 2 0 7 0
3 1 4 4 2 0 7 0
4 1 4 4 2 0 7 0
.. ... ... ... ... ... ... ...
475 0 3 3 1 0 2 1
476 0 3 3 1 0 5 0
477 0 3 3 1 0 5 1
478 0 3 3 1 0 6 0
479 0 3 3 1 0 6 1
Relation raisedhands VisITedResources AnnouncementsView Discussion \
0 0 15 16 2 20
1 0 20 20 3 25
2 0 10 7 0 30
3 0 30 25 5 35
4 0 40 50 12 50
.. ... ... ... ... ...
475 0 5 4 5 8
476 0 50 77 14 28
477 0 55 74 25 29
478 0 30 17 14 57
479 0 35 14 23 62
ParentAnsweringSurvey ParentschoolSatisfaction StudentAbsenceDays Class
0 1 1 1 M
1 1 1 1 M
2 0 0 0 L
3 0 0 0 L
4 0 0 0 M
.. ... ... ... ...
475 0 0 0 L
476 0 0 1 M
477 0 0 1 M
478 0 0 0 L
479 0 0 0 L
[480 rows x 16 columns]
gender NationalITy PlaceofBirth StageID SectionID Topic Semester \
0 1 4 4 2 0 7 0
1 1 4 4 2 0 7 0
2 1 4 4 2 0 7 0
3 1 4 4 2 0 7 0
4 1 4 4 2 0 7 0
.. ... ... ... ... ... ... ...
475 0 3 3 1 0 2 1
476 0 3 3 1 0 5 0
477 0 3 3 1 0 5 1
478 0 3 3 1 0 6 0
479 0 3 3 1 0 6 1
Relation raisedhands VisITedResources AnnouncementsView Discussion \
0 0 15 16 2 20
1 0 20 20 3 25
2 0 10 7 0 30
3 0 30 25 5 35
4 0 40 50 12 50
.. ... ... ... ... ...
475 0 5 4 5 8
476 0 50 77 14 28
477 0 55 74 25 29
478 0 30 17 14 57
479 0 35 14 23 62
ParentAnsweringSurvey ParentschoolSatisfaction StudentAbsenceDays \
0 1 1 1
1 1 1 1
2 0 0 0
3 0 0 0
4 0 0 0
.. ... ... ...
475 0 0 0
476 0 0 1
477 0 0 1
478 0 0 0
479 0 0 0
Class
0 2
1 2
2 1
3 1
4 2
.. ...
475 1
476 2
477 2
478 1
479 1
[480 rows x 16 columns]
from sklearn.preprocessing import LabelEncoder
Features = data.drop('SectionID',axis=1)
Target = data['SectionID']
label = LabelEncoder()
Cat_colums = Features.dtypes.pipe(lambda Feature: Feature[Feature=='object']).index
for col in Cat_colums:
Features[col]=label.fit_transform(Features[col])
print(Features)
gender NationalITy PlaceofBirth StageID GradeID Topic \
0 1 KW KuwaIT lowerlevel G-04 IT
1 1 KW KuwaIT lowerlevel G-04 IT
2 1 KW KuwaIT lowerlevel G-04 IT
3 1 KW KuwaIT lowerlevel G-04 IT
4 1 KW KuwaIT lowerlevel G-04 IT
.. ... ... ... ... ... ...
475 0 Jordan Jordan MiddleSchool G-08 Chemistry
476 0 Jordan Jordan MiddleSchool G-08 Geology
477 0 Jordan Jordan MiddleSchool G-08 Geology
478 0 Jordan Jordan MiddleSchool G-08 History
479 0 Jordan Jordan MiddleSchool G-08 History
Semester Relation raisedhands VisITedResources AnnouncementsView \
0 F Father 15 16 2
1 F Father 20 20 3
2 F Father 10 7 0
3 F Father 30 25 5
4 F Father 40 50 12
.. ... ... ... ... ...
475 S Father 5 4 5
476 F Father 50 77 14
477 S Father 55 74 25
478 F Father 30 17 14
479 S Father 35 14 23
Discussion ParentAnsweringSurvey ParentschoolSatisfaction \
0 20 Yes Good
1 25 Yes Good
2 30 No Bad
3 35 No Bad
4 50 No Bad
.. ... ... ...
475 8 No Bad
476 28 No Bad
477 29 No Bad
478 57 No Bad
479 62 No Bad
StudentAbsenceDays Class
0 Under-7 M
1 Under-7 M
2 Above-7 L
3 Above-7 L
4 Above-7 M
.. ... ...
475 Above-7 L
476 Under-7 M
477 Under-7 M
478 Above-7 L
479 Above-7 L
[480 rows x 16 columns]
gender NationalITy PlaceofBirth StageID GradeID Topic \
0 1 4 KuwaIT lowerlevel G-04 IT
1 1 4 KuwaIT lowerlevel G-04 IT
2 1 4 KuwaIT lowerlevel G-04 IT
3 1 4 KuwaIT lowerlevel G-04 IT
4 1 4 KuwaIT lowerlevel G-04 IT
.. ... ... ... ... ... ...
475 0 3 Jordan MiddleSchool G-08 Chemistry
476 0 3 Jordan MiddleSchool G-08 Geology
477 0 3 Jordan MiddleSchool G-08 Geology
478 0 3 Jordan MiddleSchool G-08 History
479 0 3 Jordan MiddleSchool G-08 History
Semester Relation raisedhands VisITedResources AnnouncementsView \
0 F Father 15 16 2
1 F Father 20 20 3
2 F Father 10 7 0
3 F Father 30 25 5
4 F Father 40 50 12
.. ... ... ... ... ...
475 S Father 5 4 5
476 F Father 50 77 14
477 S Father 55 74 25
478 F Father 30 17 14
479 S Father 35 14 23
Discussion ParentAnsweringSurvey ParentschoolSatisfaction \
0 20 Yes Good
1 25 Yes Good
2 30 No Bad
3 35 No Bad
4 50 No Bad
.. ... ... ...
475 8 No Bad
476 28 No Bad
477 29 No Bad
478 57 No Bad
479 62 No Bad
StudentAbsenceDays Class
0 Under-7 M
1 Under-7 M
2 Above-7 L
3 Above-7 L
4 Above-7 M
.. ... ...
475 Above-7 L
476 Under-7 M
477 Under-7 M
478 Above-7 L
479 Above-7 L
[480 rows x 16 columns]
gender NationalITy PlaceofBirth StageID GradeID Topic \
0 1 4 4 lowerlevel G-04 IT
1 1 4 4 lowerlevel G-04 IT
2 1 4 4 lowerlevel G-04 IT
3 1 4 4 lowerlevel G-04 IT
4 1 4 4 lowerlevel G-04 IT
.. ... ... ... ... ... ...
475 0 3 3 MiddleSchool G-08 Chemistry
476 0 3 3 MiddleSchool G-08 Geology
477 0 3 3 MiddleSchool G-08 Geology
478 0 3 3 MiddleSchool G-08 History
479 0 3 3 MiddleSchool G-08 History
Semester Relation raisedhands VisITedResources AnnouncementsView \
0 F Father 15 16 2
1 F Father 20 20 3
2 F Father 10 7 0
3 F Father 30 25 5
4 F Father 40 50 12
.. ... ... ... ... ...
475 S Father 5 4 5
476 F Father 50 77 14
477 S Father 55 74 25
478 F Father 30 17 14
479 S Father 35 14 23
Discussion ParentAnsweringSurvey ParentschoolSatisfaction \
0 20 Yes Good
1 25 Yes Good
2 30 No Bad
3 35 No Bad
4 50 No Bad
.. ... ... ...
475 8 No Bad
476 28 No Bad
477 29 No Bad
478 57 No Bad
479 62 No Bad
StudentAbsenceDays Class
0 Under-7 M
1 Under-7 M
2 Above-7 L
3 Above-7 L
4 Above-7 M
.. ... ...
475 Above-7 L
476 Under-7 M
477 Under-7 M
478 Above-7 L
479 Above-7 L
[480 rows x 16 columns]
gender NationalITy PlaceofBirth StageID GradeID Topic Semester \
0 1 4 4 2 G-04 IT F
1 1 4 4 2 G-04 IT F
2 1 4 4 2 G-04 IT F
3 1 4 4 2 G-04 IT F
4 1 4 4 2 G-04 IT F
.. ... ... ... ... ... ... ...
475 0 3 3 1 G-08 Chemistry S
476 0 3 3 1 G-08 Geology F
477 0 3 3 1 G-08 Geology S
478 0 3 3 1 G-08 History F
479 0 3 3 1 G-08 History S
Relation raisedhands VisITedResources AnnouncementsView Discussion \
0 Father 15 16 2 20
1 Father 20 20 3 25
2 Father 10 7 0 30
3 Father 30 25 5 35
4 Father 40 50 12 50
.. ... ... ... ... ...
475 Father 5 4 5 8
476 Father 50 77 14 28
477 Father 55 74 25 29
478 Father 30 17 14 57
479 Father 35 14 23 62
ParentAnsweringSurvey ParentschoolSatisfaction StudentAbsenceDays Class
0 Yes Good Under-7 M
1 Yes Good Under-7 M
2 No Bad Above-7 L
3 No Bad Above-7 L
4 No Bad Above-7 M
.. ... ... ... ...
475 No Bad Above-7 L
476 No Bad Under-7 M
477 No Bad Under-7 M
478 No Bad Above-7 L
479 No Bad Above-7 L
[480 rows x 16 columns]
gender NationalITy PlaceofBirth StageID GradeID Topic Semester \
0 1 4 4 2 1 IT F
1 1 4 4 2 1 IT F
2 1 4 4 2 1 IT F
3 1 4 4 2 1 IT F
4 1 4 4 2 1 IT F
.. ... ... ... ... ... ... ...
475 0 3 3 1 5 Chemistry S
476 0 3 3 1 5 Geology F
477 0 3 3 1 5 Geology S
478 0 3 3 1 5 History F
479 0 3 3 1 5 History S
Relation raisedhands VisITedResources AnnouncementsView Discussion \
0 Father 15 16 2 20
1 Father 20 20 3 25
2 Father 10 7 0 30
3 Father 30 25 5 35
4 Father 40 50 12 50
.. ... ... ... ... ...
475 Father 5 4 5 8
476 Father 50 77 14 28
477 Father 55 74 25 29
478 Father 30 17 14 57
479 Father 35 14 23 62
ParentAnsweringSurvey ParentschoolSatisfaction StudentAbsenceDays Class
0 Yes Good Under-7 M
1 Yes Good Under-7 M
2 No Bad Above-7 L
3 No Bad Above-7 L
4 No Bad Above-7 M
.. ... ... ... ...
475 No Bad Above-7 L
476 No Bad Under-7 M
477 No Bad Under-7 M
478 No Bad Above-7 L
479 No Bad Above-7 L
[480 rows x 16 columns]
gender NationalITy PlaceofBirth StageID GradeID Topic Semester \
0 1 4 4 2 1 7 F
1 1 4 4 2 1 7 F
2 1 4 4 2 1 7 F
3 1 4 4 2 1 7 F
4 1 4 4 2 1 7 F
.. ... ... ... ... ... ... ...
475 0 3 3 1 5 2 S
476 0 3 3 1 5 5 F
477 0 3 3 1 5 5 S
478 0 3 3 1 5 6 F
479 0 3 3 1 5 6 S
Relation raisedhands VisITedResources AnnouncementsView Discussion \
0 Father 15 16 2 20
1 Father 20 20 3 25
2 Father 10 7 0 30
3 Father 30 25 5 35
4 Father 40 50 12 50
.. ... ... ... ... ...
475 Father 5 4 5 8
476 Father 50 77 14 28
477 Father 55 74 25 29
478 Father 30 17 14 57
479 Father 35 14 23 62
ParentAnsweringSurvey ParentschoolSatisfaction StudentAbsenceDays Class
0 Yes Good Under-7 M
1 Yes Good Under-7 M
2 No Bad Above-7 L
3 No Bad Above-7 L
4 No Bad Above-7 M
.. ... ... ... ...
475 No Bad Above-7 L
476 No Bad Under-7 M
477 No Bad Under-7 M
478 No Bad Above-7 L
479 No Bad Above-7 L
[480 rows x 16 columns]
gender NationalITy PlaceofBirth StageID GradeID Topic Semester \
0 1 4 4 2 1 7 0
1 1 4 4 2 1 7 0
2 1 4 4 2 1 7 0
3 1 4 4 2 1 7 0
4 1 4 4 2 1 7 0
.. ... ... ... ... ... ... ...
475 0 3 3 1 5 2 1
476 0 3 3 1 5 5 0
477 0 3 3 1 5 5 1
478 0 3 3 1 5 6 0
479 0 3 3 1 5 6 1
Relation raisedhands VisITedResources AnnouncementsView Discussion \
0 Father 15 16 2 20
1 Father 20 20 3 25
2 Father 10 7 0 30
3 Father 30 25 5 35
4 Father 40 50 12 50
.. ... ... ... ... ...
475 Father 5 4 5 8
476 Father 50 77 14 28
477 Father 55 74 25 29
478 Father 30 17 14 57
479 Father 35 14 23 62
ParentAnsweringSurvey ParentschoolSatisfaction StudentAbsenceDays Class
0 Yes Good Under-7 M
1 Yes Good Under-7 M
2 No Bad Above-7 L
3 No Bad Above-7 L
4 No Bad Above-7 M
.. ... ... ... ...
475 No Bad Above-7 L
476 No Bad Under-7 M
477 No Bad Under-7 M
478 No Bad Above-7 L
479 No Bad Above-7 L
[480 rows x 16 columns]
gender NationalITy PlaceofBirth StageID GradeID Topic Semester \
0 1 4 4 2 1 7 0
1 1 4 4 2 1 7 0
2 1 4 4 2 1 7 0
3 1 4 4 2 1 7 0
4 1 4 4 2 1 7 0
.. ... ... ... ... ... ... ...
475 0 3 3 1 5 2 1
476 0 3 3 1 5 5 0
477 0 3 3 1 5 5 1
478 0 3 3 1 5 6 0
479 0 3 3 1 5 6 1
Relation raisedhands VisITedResources AnnouncementsView Discussion \
0 0 15 16 2 20
1 0 20 20 3 25
2 0 10 7 0 30
3 0 30 25 5 35
4 0 40 50 12 50
.. ... ... ... ... ...
475 0 5 4 5 8
476 0 50 77 14 28
477 0 55 74 25 29
478 0 30 17 14 57
479 0 35 14 23 62
ParentAnsweringSurvey ParentschoolSatisfaction StudentAbsenceDays Class
0 Yes Good Under-7 M
1 Yes Good Under-7 M
2 No Bad Above-7 L
3 No Bad Above-7 L
4 No Bad Above-7 M
.. ... ... ... ...
475 No Bad Above-7 L
476 No Bad Under-7 M
477 No Bad Under-7 M
478 No Bad Above-7 L
479 No Bad Above-7 L
[480 rows x 16 columns]
gender NationalITy PlaceofBirth StageID GradeID Topic Semester \
0 1 4 4 2 1 7 0
1 1 4 4 2 1 7 0
2 1 4 4 2 1 7 0
3 1 4 4 2 1 7 0
4 1 4 4 2 1 7 0
.. ... ... ... ... ... ... ...
475 0 3 3 1 5 2 1
476 0 3 3 1 5 5 0
477 0 3 3 1 5 5 1
478 0 3 3 1 5 6 0
479 0 3 3 1 5 6 1
Relation raisedhands VisITedResources AnnouncementsView Discussion \
0 0 15 16 2 20
1 0 20 20 3 25
2 0 10 7 0 30
3 0 30 25 5 35
4 0 40 50 12 50
.. ... ... ... ... ...
475 0 5 4 5 8
476 0 50 77 14 28
477 0 55 74 25 29
478 0 30 17 14 57
479 0 35 14 23 62
ParentAnsweringSurvey ParentschoolSatisfaction StudentAbsenceDays Class
0 1 Good Under-7 M
1 1 Good Under-7 M
2 0 Bad Above-7 L
3 0 Bad Above-7 L
4 0 Bad Above-7 M
.. ... ... ... ...
475 0 Bad Above-7 L
476 0 Bad Under-7 M
477 0 Bad Under-7 M
478 0 Bad Above-7 L
479 0 Bad Above-7 L
[480 rows x 16 columns]
gender NationalITy PlaceofBirth StageID GradeID Topic Semester \
0 1 4 4 2 1 7 0
1 1 4 4 2 1 7 0
2 1 4 4 2 1 7 0
3 1 4 4 2 1 7 0
4 1 4 4 2 1 7 0
.. ... ... ... ... ... ... ...
475 0 3 3 1 5 2 1
476 0 3 3 1 5 5 0
477 0 3 3 1 5 5 1
478 0 3 3 1 5 6 0
479 0 3 3 1 5 6 1
Relation raisedhands VisITedResources AnnouncementsView Discussion \
0 0 15 16 2 20
1 0 20 20 3 25
2 0 10 7 0 30
3 0 30 25 5 35
4 0 40 50 12 50
.. ... ... ... ... ...
475 0 5 4 5 8
476 0 50 77 14 28
477 0 55 74 25 29
478 0 30 17 14 57
479 0 35 14 23 62
ParentAnsweringSurvey ParentschoolSatisfaction StudentAbsenceDays Class
0 1 1 Under-7 M
1 1 1 Under-7 M
2 0 0 Above-7 L
3 0 0 Above-7 L
4 0 0 Above-7 M
.. ... ... ... ...
475 0 0 Above-7 L
476 0 0 Under-7 M
477 0 0 Under-7 M
478 0 0 Above-7 L
479 0 0 Above-7 L
[480 rows x 16 columns]
gender NationalITy PlaceofBirth StageID GradeID Topic Semester \
0 1 4 4 2 1 7 0
1 1 4 4 2 1 7 0
2 1 4 4 2 1 7 0
3 1 4 4 2 1 7 0
4 1 4 4 2 1 7 0
.. ... ... ... ... ... ... ...
475 0 3 3 1 5 2 1
476 0 3 3 1 5 5 0
477 0 3 3 1 5 5 1
478 0 3 3 1 5 6 0
479 0 3 3 1 5 6 1
Relation raisedhands VisITedResources AnnouncementsView Discussion \
0 0 15 16 2 20
1 0 20 20 3 25
2 0 10 7 0 30
3 0 30 25 5 35
4 0 40 50 12 50
.. ... ... ... ... ...
475 0 5 4 5 8
476 0 50 77 14 28
477 0 55 74 25 29
478 0 30 17 14 57
479 0 35 14 23 62
ParentAnsweringSurvey ParentschoolSatisfaction StudentAbsenceDays Class
0 1 1 1 M
1 1 1 1 M
2 0 0 0 L
3 0 0 0 L
4 0 0 0 M
.. ... ... ... ...
475 0 0 0 L
476 0 0 1 M
477 0 0 1 M
478 0 0 0 L
479 0 0 0 L
[480 rows x 16 columns]
gender NationalITy PlaceofBirth StageID GradeID Topic Semester \
0 1 4 4 2 1 7 0
1 1 4 4 2 1 7 0
2 1 4 4 2 1 7 0
3 1 4 4 2 1 7 0
4 1 4 4 2 1 7 0
.. ... ... ... ... ... ... ...
475 0 3 3 1 5 2 1
476 0 3 3 1 5 5 0
477 0 3 3 1 5 5 1
478 0 3 3 1 5 6 0
479 0 3 3 1 5 6 1
Relation raisedhands VisITedResources AnnouncementsView Discussion \
0 0 15 16 2 20
1 0 20 20 3 25
2 0 10 7 0 30
3 0 30 25 5 35
4 0 40 50 12 50
.. ... ... ... ... ...
475 0 5 4 5 8
476 0 50 77 14 28
477 0 55 74 25 29
478 0 30 17 14 57
479 0 35 14 23 62
ParentAnsweringSurvey ParentschoolSatisfaction StudentAbsenceDays \
0 1 1 1
1 1 1 1
2 0 0 0
3 0 0 0
4 0 0 0
.. ... ... ...
475 0 0 0
476 0 0 1
477 0 0 1
478 0 0 0
479 0 0 0
Class
0 2
1 2
2 1
3 1
4 2
.. ...
475 1
476 2
477 2
478 1
479 1
[480 rows x 16 columns]
from sklearn.preprocessing import LabelEncoder
Features = data.drop('ParentAnsweringSurvey',axis=1)
Target = data['ParentAnsweringSurvey']
label = LabelEncoder()
Cat_colums = Features.dtypes.pipe(lambda Feature: Feature[Feature=='object']).index
for col in Cat_colums:
Features[col]=label.fit_transform(Features[col])
print(Features)
gender NationalITy PlaceofBirth StageID GradeID SectionID \
0 1 KW KuwaIT lowerlevel G-04 A
1 1 KW KuwaIT lowerlevel G-04 A
2 1 KW KuwaIT lowerlevel G-04 A
3 1 KW KuwaIT lowerlevel G-04 A
4 1 KW KuwaIT lowerlevel G-04 A
.. ... ... ... ... ... ...
475 0 Jordan Jordan MiddleSchool G-08 A
476 0 Jordan Jordan MiddleSchool G-08 A
477 0 Jordan Jordan MiddleSchool G-08 A
478 0 Jordan Jordan MiddleSchool G-08 A
479 0 Jordan Jordan MiddleSchool G-08 A
Topic Semester Relation raisedhands VisITedResources \
0 IT F Father 15 16
1 IT F Father 20 20
2 IT F Father 10 7
3 IT F Father 30 25
4 IT F Father 40 50
.. ... ... ... ... ...
475 Chemistry S Father 5 4
476 Geology F Father 50 77
477 Geology S Father 55 74
478 History F Father 30 17
479 History S Father 35 14
AnnouncementsView Discussion ParentschoolSatisfaction \
0 2 20 Good
1 3 25 Good
2 0 30 Bad
3 5 35 Bad
4 12 50 Bad
.. ... ... ...
475 5 8 Bad
476 14 28 Bad
477 25 29 Bad
478 14 57 Bad
479 23 62 Bad
StudentAbsenceDays Class
0 Under-7 M
1 Under-7 M
2 Above-7 L
3 Above-7 L
4 Above-7 M
.. ... ...
475 Above-7 L
476 Under-7 M
477 Under-7 M
478 Above-7 L
479 Above-7 L
[480 rows x 16 columns]
gender NationalITy PlaceofBirth StageID GradeID SectionID \
0 1 4 KuwaIT lowerlevel G-04 A
1 1 4 KuwaIT lowerlevel G-04 A
2 1 4 KuwaIT lowerlevel G-04 A
3 1 4 KuwaIT lowerlevel G-04 A
4 1 4 KuwaIT lowerlevel G-04 A
.. ... ... ... ... ... ...
475 0 3 Jordan MiddleSchool G-08 A
476 0 3 Jordan MiddleSchool G-08 A
477 0 3 Jordan MiddleSchool G-08 A
478 0 3 Jordan MiddleSchool G-08 A
479 0 3 Jordan MiddleSchool G-08 A
Topic Semester Relation raisedhands VisITedResources \
0 IT F Father 15 16
1 IT F Father 20 20
2 IT F Father 10 7
3 IT F Father 30 25
4 IT F Father 40 50
.. ... ... ... ... ...
475 Chemistry S Father 5 4
476 Geology F Father 50 77
477 Geology S Father 55 74
478 History F Father 30 17
479 History S Father 35 14
AnnouncementsView Discussion ParentschoolSatisfaction \
0 2 20 Good
1 3 25 Good
2 0 30 Bad
3 5 35 Bad
4 12 50 Bad
.. ... ... ...
475 5 8 Bad
476 14 28 Bad
477 25 29 Bad
478 14 57 Bad
479 23 62 Bad
StudentAbsenceDays Class
0 Under-7 M
1 Under-7 M
2 Above-7 L
3 Above-7 L
4 Above-7 M
.. ... ...
475 Above-7 L
476 Under-7 M
477 Under-7 M
478 Above-7 L
479 Above-7 L
[480 rows x 16 columns]
gender NationalITy PlaceofBirth StageID GradeID SectionID \
0 1 4 4 lowerlevel G-04 A
1 1 4 4 lowerlevel G-04 A
2 1 4 4 lowerlevel G-04 A
3 1 4 4 lowerlevel G-04 A
4 1 4 4 lowerlevel G-04 A
.. ... ... ... ... ... ...
475 0 3 3 MiddleSchool G-08 A
476 0 3 3 MiddleSchool G-08 A
477 0 3 3 MiddleSchool G-08 A
478 0 3 3 MiddleSchool G-08 A
479 0 3 3 MiddleSchool G-08 A
Topic Semester Relation raisedhands VisITedResources \
0 IT F Father 15 16
1 IT F Father 20 20
2 IT F Father 10 7
3 IT F Father 30 25
4 IT F Father 40 50
.. ... ... ... ... ...
475 Chemistry S Father 5 4
476 Geology F Father 50 77
477 Geology S Father 55 74
478 History F Father 30 17
479 History S Father 35 14
AnnouncementsView Discussion ParentschoolSatisfaction \
0 2 20 Good
1 3 25 Good
2 0 30 Bad
3 5 35 Bad
4 12 50 Bad
.. ... ... ...
475 5 8 Bad
476 14 28 Bad
477 25 29 Bad
478 14 57 Bad
479 23 62 Bad
StudentAbsenceDays Class
0 Under-7 M
1 Under-7 M
2 Above-7 L
3 Above-7 L
4 Above-7 M
.. ... ...
475 Above-7 L
476 Under-7 M
477 Under-7 M
478 Above-7 L
479 Above-7 L
[480 rows x 16 columns]
gender NationalITy PlaceofBirth StageID GradeID SectionID Topic \
0 1 4 4 2 G-04 A IT
1 1 4 4 2 G-04 A IT
2 1 4 4 2 G-04 A IT
3 1 4 4 2 G-04 A IT
4 1 4 4 2 G-04 A IT
.. ... ... ... ... ... ... ...
475 0 3 3 1 G-08 A Chemistry
476 0 3 3 1 G-08 A Geology
477 0 3 3 1 G-08 A Geology
478 0 3 3 1 G-08 A History
479 0 3 3 1 G-08 A History
Semester Relation raisedhands VisITedResources AnnouncementsView \
0 F Father 15 16 2
1 F Father 20 20 3
2 F Father 10 7 0
3 F Father 30 25 5
4 F Father 40 50 12
.. ... ... ... ... ...
475 S Father 5 4 5
476 F Father 50 77 14
477 S Father 55 74 25
478 F Father 30 17 14
479 S Father 35 14 23
Discussion ParentschoolSatisfaction StudentAbsenceDays Class
0 20 Good Under-7 M
1 25 Good Under-7 M
2 30 Bad Above-7 L
3 35 Bad Above-7 L
4 50 Bad Above-7 M
.. ... ... ... ...
475 8 Bad Above-7 L
476 28 Bad Under-7 M
477 29 Bad Under-7 M
478 57 Bad Above-7 L
479 62 Bad Above-7 L
[480 rows x 16 columns]
gender NationalITy PlaceofBirth StageID GradeID SectionID Topic \
0 1 4 4 2 1 A IT
1 1 4 4 2 1 A IT
2 1 4 4 2 1 A IT
3 1 4 4 2 1 A IT
4 1 4 4 2 1 A IT
.. ... ... ... ... ... ... ...
475 0 3 3 1 5 A Chemistry
476 0 3 3 1 5 A Geology
477 0 3 3 1 5 A Geology
478 0 3 3 1 5 A History
479 0 3 3 1 5 A History
Semester Relation raisedhands VisITedResources AnnouncementsView \
0 F Father 15 16 2
1 F Father 20 20 3
2 F Father 10 7 0
3 F Father 30 25 5
4 F Father 40 50 12
.. ... ... ... ... ...
475 S Father 5 4 5
476 F Father 50 77 14
477 S Father 55 74 25
478 F Father 30 17 14
479 S Father 35 14 23
Discussion ParentschoolSatisfaction StudentAbsenceDays Class
0 20 Good Under-7 M
1 25 Good Under-7 M
2 30 Bad Above-7 L
3 35 Bad Above-7 L
4 50 Bad Above-7 M
.. ... ... ... ...
475 8 Bad Above-7 L
476 28 Bad Under-7 M
477 29 Bad Under-7 M
478 57 Bad Above-7 L
479 62 Bad Above-7 L
[480 rows x 16 columns]
gender NationalITy PlaceofBirth StageID GradeID SectionID \
0 1 4 4 2 1 0
1 1 4 4 2 1 0
2 1 4 4 2 1 0
3 1 4 4 2 1 0
4 1 4 4 2 1 0
.. ... ... ... ... ... ...
475 0 3 3 1 5 0
476 0 3 3 1 5 0
477 0 3 3 1 5 0
478 0 3 3 1 5 0
479 0 3 3 1 5 0
Topic Semester Relation raisedhands VisITedResources \
0 IT F Father 15 16
1 IT F Father 20 20
2 IT F Father 10 7
3 IT F Father 30 25
4 IT F Father 40 50
.. ... ... ... ... ...
475 Chemistry S Father 5 4
476 Geology F Father 50 77
477 Geology S Father 55 74
478 History F Father 30 17
479 History S Father 35 14
AnnouncementsView Discussion ParentschoolSatisfaction \
0 2 20 Good
1 3 25 Good
2 0 30 Bad
3 5 35 Bad
4 12 50 Bad
.. ... ... ...
475 5 8 Bad
476 14 28 Bad
477 25 29 Bad
478 14 57 Bad
479 23 62 Bad
StudentAbsenceDays Class
0 Under-7 M
1 Under-7 M
2 Above-7 L
3 Above-7 L
4 Above-7 M
.. ... ...
475 Above-7 L
476 Under-7 M
477 Under-7 M
478 Above-7 L
479 Above-7 L
[480 rows x 16 columns]
gender NationalITy PlaceofBirth StageID GradeID SectionID Topic \
0 1 4 4 2 1 0 7
1 1 4 4 2 1 0 7
2 1 4 4 2 1 0 7
3 1 4 4 2 1 0 7
4 1 4 4 2 1 0 7
.. ... ... ... ... ... ... ...
475 0 3 3 1 5 0 2
476 0 3 3 1 5 0 5
477 0 3 3 1 5 0 5
478 0 3 3 1 5 0 6
479 0 3 3 1 5 0 6
Semester Relation raisedhands VisITedResources AnnouncementsView \
0 F Father 15 16 2
1 F Father 20 20 3
2 F Father 10 7 0
3 F Father 30 25 5
4 F Father 40 50 12
.. ... ... ... ... ...
475 S Father 5 4 5
476 F Father 50 77 14
477 S Father 55 74 25
478 F Father 30 17 14
479 S Father 35 14 23
Discussion ParentschoolSatisfaction StudentAbsenceDays Class
0 20 Good Under-7 M
1 25 Good Under-7 M
2 30 Bad Above-7 L
3 35 Bad Above-7 L
4 50 Bad Above-7 M
.. ... ... ... ...
475 8 Bad Above-7 L
476 28 Bad Under-7 M
477 29 Bad Under-7 M
478 57 Bad Above-7 L
479 62 Bad Above-7 L
[480 rows x 16 columns]
gender NationalITy PlaceofBirth StageID GradeID SectionID Topic \
0 1 4 4 2 1 0 7
1 1 4 4 2 1 0 7
2 1 4 4 2 1 0 7
3 1 4 4 2 1 0 7
4 1 4 4 2 1 0 7
.. ... ... ... ... ... ... ...
475 0 3 3 1 5 0 2
476 0 3 3 1 5 0 5
477 0 3 3 1 5 0 5
478 0 3 3 1 5 0 6
479 0 3 3 1 5 0 6
Semester Relation raisedhands VisITedResources AnnouncementsView \
0 0 Father 15 16 2
1 0 Father 20 20 3
2 0 Father 10 7 0
3 0 Father 30 25 5
4 0 Father 40 50 12
.. ... ... ... ... ...
475 1 Father 5 4 5
476 0 Father 50 77 14
477 1 Father 55 74 25
478 0 Father 30 17 14
479 1 Father 35 14 23
Discussion ParentschoolSatisfaction StudentAbsenceDays Class
0 20 Good Under-7 M
1 25 Good Under-7 M
2 30 Bad Above-7 L
3 35 Bad Above-7 L
4 50 Bad Above-7 M
.. ... ... ... ...
475 8 Bad Above-7 L
476 28 Bad Under-7 M
477 29 Bad Under-7 M
478 57 Bad Above-7 L
479 62 Bad Above-7 L
[480 rows x 16 columns]
gender NationalITy PlaceofBirth StageID GradeID SectionID Topic \
0 1 4 4 2 1 0 7
1 1 4 4 2 1 0 7
2 1 4 4 2 1 0 7
3 1 4 4 2 1 0 7
4 1 4 4 2 1 0 7
.. ... ... ... ... ... ... ...
475 0 3 3 1 5 0 2
476 0 3 3 1 5 0 5
477 0 3 3 1 5 0 5
478 0 3 3 1 5 0 6
479 0 3 3 1 5 0 6
Semester Relation raisedhands VisITedResources AnnouncementsView \
0 0 0 15 16 2
1 0 0 20 20 3
2 0 0 10 7 0
3 0 0 30 25 5
4 0 0 40 50 12
.. ... ... ... ... ...
475 1 0 5 4 5
476 0 0 50 77 14
477 1 0 55 74 25
478 0 0 30 17 14
479 1 0 35 14 23
Discussion ParentschoolSatisfaction StudentAbsenceDays Class
0 20 Good Under-7 M
1 25 Good Under-7 M
2 30 Bad Above-7 L
3 35 Bad Above-7 L
4 50 Bad Above-7 M
.. ... ... ... ...
475 8 Bad Above-7 L
476 28 Bad Under-7 M
477 29 Bad Under-7 M
478 57 Bad Above-7 L
479 62 Bad Above-7 L
[480 rows x 16 columns]
gender NationalITy PlaceofBirth StageID GradeID SectionID Topic \
0 1 4 4 2 1 0 7
1 1 4 4 2 1 0 7
2 1 4 4 2 1 0 7
3 1 4 4 2 1 0 7
4 1 4 4 2 1 0 7
.. ... ... ... ... ... ... ...
475 0 3 3 1 5 0 2
476 0 3 3 1 5 0 5
477 0 3 3 1 5 0 5
478 0 3 3 1 5 0 6
479 0 3 3 1 5 0 6
Semester Relation raisedhands VisITedResources AnnouncementsView \
0 0 0 15 16 2
1 0 0 20 20 3
2 0 0 10 7 0
3 0 0 30 25 5
4 0 0 40 50 12
.. ... ... ... ... ...
475 1 0 5 4 5
476 0 0 50 77 14
477 1 0 55 74 25
478 0 0 30 17 14
479 1 0 35 14 23
Discussion ParentschoolSatisfaction StudentAbsenceDays Class
0 20 1 Under-7 M
1 25 1 Under-7 M
2 30 0 Above-7 L
3 35 0 Above-7 L
4 50 0 Above-7 M
.. ... ... ... ...
475 8 0 Above-7 L
476 28 0 Under-7 M
477 29 0 Under-7 M
478 57 0 Above-7 L
479 62 0 Above-7 L
[480 rows x 16 columns]
gender NationalITy PlaceofBirth StageID GradeID SectionID Topic \
0 1 4 4 2 1 0 7
1 1 4 4 2 1 0 7
2 1 4 4 2 1 0 7
3 1 4 4 2 1 0 7
4 1 4 4 2 1 0 7
.. ... ... ... ... ... ... ...
475 0 3 3 1 5 0 2
476 0 3 3 1 5 0 5
477 0 3 3 1 5 0 5
478 0 3 3 1 5 0 6
479 0 3 3 1 5 0 6
Semester Relation raisedhands VisITedResources AnnouncementsView \
0 0 0 15 16 2
1 0 0 20 20 3
2 0 0 10 7 0
3 0 0 30 25 5
4 0 0 40 50 12
.. ... ... ... ... ...
475 1 0 5 4 5
476 0 0 50 77 14
477 1 0 55 74 25
478 0 0 30 17 14
479 1 0 35 14 23
Discussion ParentschoolSatisfaction StudentAbsenceDays Class
0 20 1 1 M
1 25 1 1 M
2 30 0 0 L
3 35 0 0 L
4 50 0 0 M
.. ... ... ... ...
475 8 0 0 L
476 28 0 1 M
477 29 0 1 M
478 57 0 0 L
479 62 0 0 L
[480 rows x 16 columns]
gender NationalITy PlaceofBirth StageID GradeID SectionID Topic \
0 1 4 4 2 1 0 7
1 1 4 4 2 1 0 7
2 1 4 4 2 1 0 7
3 1 4 4 2 1 0 7
4 1 4 4 2 1 0 7
.. ... ... ... ... ... ... ...
475 0 3 3 1 5 0 2
476 0 3 3 1 5 0 5
477 0 3 3 1 5 0 5
478 0 3 3 1 5 0 6
479 0 3 3 1 5 0 6
Semester Relation raisedhands VisITedResources AnnouncementsView \
0 0 0 15 16 2
1 0 0 20 20 3
2 0 0 10 7 0
3 0 0 30 25 5
4 0 0 40 50 12
.. ... ... ... ... ...
475 1 0 5 4 5
476 0 0 50 77 14
477 1 0 55 74 25
478 0 0 30 17 14
479 1 0 35 14 23
Discussion ParentschoolSatisfaction StudentAbsenceDays Class
0 20 1 1 2
1 25 1 1 2
2 30 0 0 1
3 35 0 0 1
4 50 0 0 2
.. ... ... ... ...
475 8 0 0 1
476 28 0 1 2
477 29 0 1 2
478 57 0 0 1
479 62 0 0 1
[480 rows x 16 columns]
from sklearn.preprocessing import LabelEncoder
Features = data.drop('ParentschoolSatisfaction',axis=1)
Target = data['ParentschoolSatisfaction']
label = LabelEncoder()
Cat_colums = Features.dtypes.pipe(lambda Feature: Feature[Feature=='object']).index
for col in Cat_colums:
Features[col]=label.fit_transform(Features[col])
print(Features)
gender NationalITy PlaceofBirth StageID GradeID SectionID \
0 1 KW KuwaIT lowerlevel G-04 A
1 1 KW KuwaIT lowerlevel G-04 A
2 1 KW KuwaIT lowerlevel G-04 A
3 1 KW KuwaIT lowerlevel G-04 A
4 1 KW KuwaIT lowerlevel G-04 A
.. ... ... ... ... ... ...
475 0 Jordan Jordan MiddleSchool G-08 A
476 0 Jordan Jordan MiddleSchool G-08 A
477 0 Jordan Jordan MiddleSchool G-08 A
478 0 Jordan Jordan MiddleSchool G-08 A
479 0 Jordan Jordan MiddleSchool G-08 A
Topic Semester Relation raisedhands VisITedResources \
0 IT F Father 15 16
1 IT F Father 20 20
2 IT F Father 10 7
3 IT F Father 30 25
4 IT F Father 40 50
.. ... ... ... ... ...
475 Chemistry S Father 5 4
476 Geology F Father 50 77
477 Geology S Father 55 74
478 History F Father 30 17
479 History S Father 35 14
AnnouncementsView Discussion ParentAnsweringSurvey StudentAbsenceDays \
0 2 20 Yes Under-7
1 3 25 Yes Under-7
2 0 30 No Above-7
3 5 35 No Above-7
4 12 50 No Above-7
.. ... ... ... ...
475 5 8 No Above-7
476 14 28 No Under-7
477 25 29 No Under-7
478 14 57 No Above-7
479 23 62 No Above-7
Class
0 M
1 M
2 L
3 L
4 M
.. ...
475 L
476 M
477 M
478 L
479 L
[480 rows x 16 columns]
gender NationalITy PlaceofBirth StageID GradeID SectionID \
0 1 4 KuwaIT lowerlevel G-04 A
1 1 4 KuwaIT lowerlevel G-04 A
2 1 4 KuwaIT lowerlevel G-04 A
3 1 4 KuwaIT lowerlevel G-04 A
4 1 4 KuwaIT lowerlevel G-04 A
.. ... ... ... ... ... ...
475 0 3 Jordan MiddleSchool G-08 A
476 0 3 Jordan MiddleSchool G-08 A
477 0 3 Jordan MiddleSchool G-08 A
478 0 3 Jordan MiddleSchool G-08 A
479 0 3 Jordan MiddleSchool G-08 A
Topic Semester Relation raisedhands VisITedResources \
0 IT F Father 15 16
1 IT F Father 20 20
2 IT F Father 10 7
3 IT F Father 30 25
4 IT F Father 40 50
.. ... ... ... ... ...
475 Chemistry S Father 5 4
476 Geology F Father 50 77
477 Geology S Father 55 74
478 History F Father 30 17
479 History S Father 35 14
AnnouncementsView Discussion ParentAnsweringSurvey StudentAbsenceDays \
0 2 20 Yes Under-7
1 3 25 Yes Under-7
2 0 30 No Above-7
3 5 35 No Above-7
4 12 50 No Above-7
.. ... ... ... ...
475 5 8 No Above-7
476 14 28 No Under-7
477 25 29 No Under-7
478 14 57 No Above-7
479 23 62 No Above-7
Class
0 M
1 M
2 L
3 L
4 M
.. ...
475 L
476 M
477 M
478 L
479 L
[480 rows x 16 columns]
gender NationalITy PlaceofBirth StageID GradeID SectionID \
0 1 4 4 lowerlevel G-04 A
1 1 4 4 lowerlevel G-04 A
2 1 4 4 lowerlevel G-04 A
3 1 4 4 lowerlevel G-04 A
4 1 4 4 lowerlevel G-04 A
.. ... ... ... ... ... ...
475 0 3 3 MiddleSchool G-08 A
476 0 3 3 MiddleSchool G-08 A
477 0 3 3 MiddleSchool G-08 A
478 0 3 3 MiddleSchool G-08 A
479 0 3 3 MiddleSchool G-08 A
Topic Semester Relation raisedhands VisITedResources \
0 IT F Father 15 16
1 IT F Father 20 20
2 IT F Father 10 7
3 IT F Father 30 25
4 IT F Father 40 50
.. ... ... ... ... ...
475 Chemistry S Father 5 4
476 Geology F Father 50 77
477 Geology S Father 55 74
478 History F Father 30 17
479 History S Father 35 14
AnnouncementsView Discussion ParentAnsweringSurvey StudentAbsenceDays \
0 2 20 Yes Under-7
1 3 25 Yes Under-7
2 0 30 No Above-7
3 5 35 No Above-7
4 12 50 No Above-7
.. ... ... ... ...
475 5 8 No Above-7
476 14 28 No Under-7
477 25 29 No Under-7
478 14 57 No Above-7
479 23 62 No Above-7
Class
0 M
1 M
2 L
3 L
4 M
.. ...
475 L
476 M
477 M
478 L
479 L
[480 rows x 16 columns]
gender NationalITy PlaceofBirth StageID GradeID SectionID Topic \
0 1 4 4 2 G-04 A IT
1 1 4 4 2 G-04 A IT
2 1 4 4 2 G-04 A IT
3 1 4 4 2 G-04 A IT
4 1 4 4 2 G-04 A IT
.. ... ... ... ... ... ... ...
475 0 3 3 1 G-08 A Chemistry
476 0 3 3 1 G-08 A Geology
477 0 3 3 1 G-08 A Geology
478 0 3 3 1 G-08 A History
479 0 3 3 1 G-08 A History
Semester Relation raisedhands VisITedResources AnnouncementsView \
0 F Father 15 16 2
1 F Father 20 20 3
2 F Father 10 7 0
3 F Father 30 25 5
4 F Father 40 50 12
.. ... ... ... ... ...
475 S Father 5 4 5
476 F Father 50 77 14
477 S Father 55 74 25
478 F Father 30 17 14
479 S Father 35 14 23
Discussion ParentAnsweringSurvey StudentAbsenceDays Class
0 20 Yes Under-7 M
1 25 Yes Under-7 M
2 30 No Above-7 L
3 35 No Above-7 L
4 50 No Above-7 M
.. ... ... ... ...
475 8 No Above-7 L
476 28 No Under-7 M
477 29 No Under-7 M
478 57 No Above-7 L
479 62 No Above-7 L
[480 rows x 16 columns]
gender NationalITy PlaceofBirth StageID GradeID SectionID Topic \
0 1 4 4 2 1 A IT
1 1 4 4 2 1 A IT
2 1 4 4 2 1 A IT
3 1 4 4 2 1 A IT
4 1 4 4 2 1 A IT
.. ... ... ... ... ... ... ...
475 0 3 3 1 5 A Chemistry
476 0 3 3 1 5 A Geology
477 0 3 3 1 5 A Geology
478 0 3 3 1 5 A History
479 0 3 3 1 5 A History
Semester Relation raisedhands VisITedResources AnnouncementsView \
0 F Father 15 16 2
1 F Father 20 20 3
2 F Father 10 7 0
3 F Father 30 25 5
4 F Father 40 50 12
.. ... ... ... ... ...
475 S Father 5 4 5
476 F Father 50 77 14
477 S Father 55 74 25
478 F Father 30 17 14
479 S Father 35 14 23
Discussion ParentAnsweringSurvey StudentAbsenceDays Class
0 20 Yes Under-7 M
1 25 Yes Under-7 M
2 30 No Above-7 L
3 35 No Above-7 L
4 50 No Above-7 M
.. ... ... ... ...
475 8 No Above-7 L
476 28 No Under-7 M
477 29 No Under-7 M
478 57 No Above-7 L
479 62 No Above-7 L
[480 rows x 16 columns]
gender NationalITy PlaceofBirth StageID GradeID SectionID \
0 1 4 4 2 1 0
1 1 4 4 2 1 0
2 1 4 4 2 1 0
3 1 4 4 2 1 0
4 1 4 4 2 1 0
.. ... ... ... ... ... ...
475 0 3 3 1 5 0
476 0 3 3 1 5 0
477 0 3 3 1 5 0
478 0 3 3 1 5 0
479 0 3 3 1 5 0
Topic Semester Relation raisedhands VisITedResources \
0 IT F Father 15 16
1 IT F Father 20 20
2 IT F Father 10 7
3 IT F Father 30 25
4 IT F Father 40 50
.. ... ... ... ... ...
475 Chemistry S Father 5 4
476 Geology F Father 50 77
477 Geology S Father 55 74
478 History F Father 30 17
479 History S Father 35 14
AnnouncementsView Discussion ParentAnsweringSurvey StudentAbsenceDays \
0 2 20 Yes Under-7
1 3 25 Yes Under-7
2 0 30 No Above-7
3 5 35 No Above-7
4 12 50 No Above-7
.. ... ... ... ...
475 5 8 No Above-7
476 14 28 No Under-7
477 25 29 No Under-7
478 14 57 No Above-7
479 23 62 No Above-7
Class
0 M
1 M
2 L
3 L
4 M
.. ...
475 L
476 M
477 M
478 L
479 L
[480 rows x 16 columns]
gender NationalITy PlaceofBirth StageID GradeID SectionID Topic \
0 1 4 4 2 1 0 7
1 1 4 4 2 1 0 7
2 1 4 4 2 1 0 7
3 1 4 4 2 1 0 7
4 1 4 4 2 1 0 7
.. ... ... ... ... ... ... ...
475 0 3 3 1 5 0 2
476 0 3 3 1 5 0 5
477 0 3 3 1 5 0 5
478 0 3 3 1 5 0 6
479 0 3 3 1 5 0 6
Semester Relation raisedhands VisITedResources AnnouncementsView \
0 F Father 15 16 2
1 F Father 20 20 3
2 F Father 10 7 0
3 F Father 30 25 5
4 F Father 40 50 12
.. ... ... ... ... ...
475 S Father 5 4 5
476 F Father 50 77 14
477 S Father 55 74 25
478 F Father 30 17 14
479 S Father 35 14 23
Discussion ParentAnsweringSurvey StudentAbsenceDays Class
0 20 Yes Under-7 M
1 25 Yes Under-7 M
2 30 No Above-7 L
3 35 No Above-7 L
4 50 No Above-7 M
.. ... ... ... ...
475 8 No Above-7 L
476 28 No Under-7 M
477 29 No Under-7 M
478 57 No Above-7 L
479 62 No Above-7 L
[480 rows x 16 columns]
gender NationalITy PlaceofBirth StageID GradeID SectionID Topic \
0 1 4 4 2 1 0 7
1 1 4 4 2 1 0 7
2 1 4 4 2 1 0 7
3 1 4 4 2 1 0 7
4 1 4 4 2 1 0 7
.. ... ... ... ... ... ... ...
475 0 3 3 1 5 0 2
476 0 3 3 1 5 0 5
477 0 3 3 1 5 0 5
478 0 3 3 1 5 0 6
479 0 3 3 1 5 0 6
Semester Relation raisedhands VisITedResources AnnouncementsView \
0 0 Father 15 16 2
1 0 Father 20 20 3
2 0 Father 10 7 0
3 0 Father 30 25 5
4 0 Father 40 50 12
.. ... ... ... ... ...
475 1 Father 5 4 5
476 0 Father 50 77 14
477 1 Father 55 74 25
478 0 Father 30 17 14
479 1 Father 35 14 23
Discussion ParentAnsweringSurvey StudentAbsenceDays Class
0 20 Yes Under-7 M
1 25 Yes Under-7 M
2 30 No Above-7 L
3 35 No Above-7 L
4 50 No Above-7 M
.. ... ... ... ...
475 8 No Above-7 L
476 28 No Under-7 M
477 29 No Under-7 M
478 57 No Above-7 L
479 62 No Above-7 L
[480 rows x 16 columns]
gender NationalITy PlaceofBirth StageID GradeID SectionID Topic \
0 1 4 4 2 1 0 7
1 1 4 4 2 1 0 7
2 1 4 4 2 1 0 7
3 1 4 4 2 1 0 7
4 1 4 4 2 1 0 7
.. ... ... ... ... ... ... ...
475 0 3 3 1 5 0 2
476 0 3 3 1 5 0 5
477 0 3 3 1 5 0 5
478 0 3 3 1 5 0 6
479 0 3 3 1 5 0 6
Semester Relation raisedhands VisITedResources AnnouncementsView \
0 0 0 15 16 2
1 0 0 20 20 3
2 0 0 10 7 0
3 0 0 30 25 5
4 0 0 40 50 12
.. ... ... ... ... ...
475 1 0 5 4 5
476 0 0 50 77 14
477 1 0 55 74 25
478 0 0 30 17 14
479 1 0 35 14 23
Discussion ParentAnsweringSurvey StudentAbsenceDays Class
0 20 Yes Under-7 M
1 25 Yes Under-7 M
2 30 No Above-7 L
3 35 No Above-7 L
4 50 No Above-7 M
.. ... ... ... ...
475 8 No Above-7 L
476 28 No Under-7 M
477 29 No Under-7 M
478 57 No Above-7 L
479 62 No Above-7 L
[480 rows x 16 columns]
gender NationalITy PlaceofBirth StageID GradeID SectionID Topic \
0 1 4 4 2 1 0 7
1 1 4 4 2 1 0 7
2 1 4 4 2 1 0 7
3 1 4 4 2 1 0 7
4 1 4 4 2 1 0 7
.. ... ... ... ... ... ... ...
475 0 3 3 1 5 0 2
476 0 3 3 1 5 0 5
477 0 3 3 1 5 0 5
478 0 3 3 1 5 0 6
479 0 3 3 1 5 0 6
Semester Relation raisedhands VisITedResources AnnouncementsView \
0 0 0 15 16 2
1 0 0 20 20 3
2 0 0 10 7 0
3 0 0 30 25 5
4 0 0 40 50 12
.. ... ... ... ... ...
475 1 0 5 4 5
476 0 0 50 77 14
477 1 0 55 74 25
478 0 0 30 17 14
479 1 0 35 14 23
Discussion ParentAnsweringSurvey StudentAbsenceDays Class
0 20 1 Under-7 M
1 25 1 Under-7 M
2 30 0 Above-7 L
3 35 0 Above-7 L
4 50 0 Above-7 M
.. ... ... ... ...
475 8 0 Above-7 L
476 28 0 Under-7 M
477 29 0 Under-7 M
478 57 0 Above-7 L
479 62 0 Above-7 L
[480 rows x 16 columns]
gender NationalITy PlaceofBirth StageID GradeID SectionID Topic \
0 1 4 4 2 1 0 7
1 1 4 4 2 1 0 7
2 1 4 4 2 1 0 7
3 1 4 4 2 1 0 7
4 1 4 4 2 1 0 7
.. ... ... ... ... ... ... ...
475 0 3 3 1 5 0 2
476 0 3 3 1 5 0 5
477 0 3 3 1 5 0 5
478 0 3 3 1 5 0 6
479 0 3 3 1 5 0 6
Semester Relation raisedhands VisITedResources AnnouncementsView \
0 0 0 15 16 2
1 0 0 20 20 3
2 0 0 10 7 0
3 0 0 30 25 5
4 0 0 40 50 12
.. ... ... ... ... ...
475 1 0 5 4 5
476 0 0 50 77 14
477 1 0 55 74 25
478 0 0 30 17 14
479 1 0 35 14 23
Discussion ParentAnsweringSurvey StudentAbsenceDays Class
0 20 1 1 M
1 25 1 1 M
2 30 0 0 L
3 35 0 0 L
4 50 0 0 M
.. ... ... ... ...
475 8 0 0 L
476 28 0 1 M
477 29 0 1 M
478 57 0 0 L
479 62 0 0 L
[480 rows x 16 columns]
gender NationalITy PlaceofBirth StageID GradeID SectionID Topic \
0 1 4 4 2 1 0 7
1 1 4 4 2 1 0 7
2 1 4 4 2 1 0 7
3 1 4 4 2 1 0 7
4 1 4 4 2 1 0 7
.. ... ... ... ... ... ... ...
475 0 3 3 1 5 0 2
476 0 3 3 1 5 0 5
477 0 3 3 1 5 0 5
478 0 3 3 1 5 0 6
479 0 3 3 1 5 0 6
Semester Relation raisedhands VisITedResources AnnouncementsView \
0 0 0 15 16 2
1 0 0 20 20 3
2 0 0 10 7 0
3 0 0 30 25 5
4 0 0 40 50 12
.. ... ... ... ... ...
475 1 0 5 4 5
476 0 0 50 77 14
477 1 0 55 74 25
478 0 0 30 17 14
479 1 0 35 14 23
Discussion ParentAnsweringSurvey StudentAbsenceDays Class
0 20 1 1 2
1 25 1 1 2
2 30 0 0 1
3 35 0 0 1
4 50 0 0 2
.. ... ... ... ...
475 8 0 0 1
476 28 0 1 2
477 29 0 1 2
478 57 0 0 1
479 62 0 0 1
[480 rows x 16 columns]
from sklearn.preprocessing import LabelEncoder
Features = data.drop('StudentAbsenceDays',axis=1)
Target = data['StudentAbsenceDays']
label = LabelEncoder()
Cat_colums = Features.dtypes.pipe(lambda Feature: Feature[Feature=='object']).index
for col in Cat_colums:
Features[col]=label.fit_transform(Features[col])
print(Features)
gender NationalITy PlaceofBirth StageID GradeID SectionID \
0 1 KW KuwaIT lowerlevel G-04 A
1 1 KW KuwaIT lowerlevel G-04 A
2 1 KW KuwaIT lowerlevel G-04 A
3 1 KW KuwaIT lowerlevel G-04 A
4 1 KW KuwaIT lowerlevel G-04 A
.. ... ... ... ... ... ...
475 0 Jordan Jordan MiddleSchool G-08 A
476 0 Jordan Jordan MiddleSchool G-08 A
477 0 Jordan Jordan MiddleSchool G-08 A
478 0 Jordan Jordan MiddleSchool G-08 A
479 0 Jordan Jordan MiddleSchool G-08 A
Topic Semester Relation raisedhands VisITedResources \
0 IT F Father 15 16
1 IT F Father 20 20
2 IT F Father 10 7
3 IT F Father 30 25
4 IT F Father 40 50
.. ... ... ... ... ...
475 Chemistry S Father 5 4
476 Geology F Father 50 77
477 Geology S Father 55 74
478 History F Father 30 17
479 History S Father 35 14
AnnouncementsView Discussion ParentAnsweringSurvey \
0 2 20 Yes
1 3 25 Yes
2 0 30 No
3 5 35 No
4 12 50 No
.. ... ... ...
475 5 8 No
476 14 28 No
477 25 29 No
478 14 57 No
479 23 62 No
ParentschoolSatisfaction Class
0 Good M
1 Good M
2 Bad L
3 Bad L
4 Bad M
.. ... ...
475 Bad L
476 Bad M
477 Bad M
478 Bad L
479 Bad L
[480 rows x 16 columns]
gender NationalITy PlaceofBirth StageID GradeID SectionID \
0 1 4 KuwaIT lowerlevel G-04 A
1 1 4 KuwaIT lowerlevel G-04 A
2 1 4 KuwaIT lowerlevel G-04 A
3 1 4 KuwaIT lowerlevel G-04 A
4 1 4 KuwaIT lowerlevel G-04 A
.. ... ... ... ... ... ...
475 0 3 Jordan MiddleSchool G-08 A
476 0 3 Jordan MiddleSchool G-08 A
477 0 3 Jordan MiddleSchool G-08 A
478 0 3 Jordan MiddleSchool G-08 A
479 0 3 Jordan MiddleSchool G-08 A
Topic Semester Relation raisedhands VisITedResources \
0 IT F Father 15 16
1 IT F Father 20 20
2 IT F Father 10 7
3 IT F Father 30 25
4 IT F Father 40 50
.. ... ... ... ... ...
475 Chemistry S Father 5 4
476 Geology F Father 50 77
477 Geology S Father 55 74
478 History F Father 30 17
479 History S Father 35 14
AnnouncementsView Discussion ParentAnsweringSurvey \
0 2 20 Yes
1 3 25 Yes
2 0 30 No
3 5 35 No
4 12 50 No
.. ... ... ...
475 5 8 No
476 14 28 No
477 25 29 No
478 14 57 No
479 23 62 No
ParentschoolSatisfaction Class
0 Good M
1 Good M
2 Bad L
3 Bad L
4 Bad M
.. ... ...
475 Bad L
476 Bad M
477 Bad M
478 Bad L
479 Bad L
[480 rows x 16 columns]
gender NationalITy PlaceofBirth StageID GradeID SectionID \
0 1 4 4 lowerlevel G-04 A
1 1 4 4 lowerlevel G-04 A
2 1 4 4 lowerlevel G-04 A
3 1 4 4 lowerlevel G-04 A
4 1 4 4 lowerlevel G-04 A
.. ... ... ... ... ... ...
475 0 3 3 MiddleSchool G-08 A
476 0 3 3 MiddleSchool G-08 A
477 0 3 3 MiddleSchool G-08 A
478 0 3 3 MiddleSchool G-08 A
479 0 3 3 MiddleSchool G-08 A
Topic Semester Relation raisedhands VisITedResources \
0 IT F Father 15 16
1 IT F Father 20 20
2 IT F Father 10 7
3 IT F Father 30 25
4 IT F Father 40 50
.. ... ... ... ... ...
475 Chemistry S Father 5 4
476 Geology F Father 50 77
477 Geology S Father 55 74
478 History F Father 30 17
479 History S Father 35 14
AnnouncementsView Discussion ParentAnsweringSurvey \
0 2 20 Yes
1 3 25 Yes
2 0 30 No
3 5 35 No
4 12 50 No
.. ... ... ...
475 5 8 No
476 14 28 No
477 25 29 No
478 14 57 No
479 23 62 No
ParentschoolSatisfaction Class
0 Good M
1 Good M
2 Bad L
3 Bad L
4 Bad M
.. ... ...
475 Bad L
476 Bad M
477 Bad M
478 Bad L
479 Bad L
[480 rows x 16 columns]
gender NationalITy PlaceofBirth StageID GradeID SectionID Topic \
0 1 4 4 2 G-04 A IT
1 1 4 4 2 G-04 A IT
2 1 4 4 2 G-04 A IT
3 1 4 4 2 G-04 A IT
4 1 4 4 2 G-04 A IT
.. ... ... ... ... ... ... ...
475 0 3 3 1 G-08 A Chemistry
476 0 3 3 1 G-08 A Geology
477 0 3 3 1 G-08 A Geology
478 0 3 3 1 G-08 A History
479 0 3 3 1 G-08 A History
Semester Relation raisedhands VisITedResources AnnouncementsView \
0 F Father 15 16 2
1 F Father 20 20 3
2 F Father 10 7 0
3 F Father 30 25 5
4 F Father 40 50 12
.. ... ... ... ... ...
475 S Father 5 4 5
476 F Father 50 77 14
477 S Father 55 74 25
478 F Father 30 17 14
479 S Father 35 14 23
Discussion ParentAnsweringSurvey ParentschoolSatisfaction Class
0 20 Yes Good M
1 25 Yes Good M
2 30 No Bad L
3 35 No Bad L
4 50 No Bad M
.. ... ... ... ...
475 8 No Bad L
476 28 No Bad M
477 29 No Bad M
478 57 No Bad L
479 62 No Bad L
[480 rows x 16 columns]
gender NationalITy PlaceofBirth StageID GradeID SectionID Topic \
0 1 4 4 2 1 A IT
1 1 4 4 2 1 A IT
2 1 4 4 2 1 A IT
3 1 4 4 2 1 A IT
4 1 4 4 2 1 A IT
.. ... ... ... ... ... ... ...
475 0 3 3 1 5 A Chemistry
476 0 3 3 1 5 A Geology
477 0 3 3 1 5 A Geology
478 0 3 3 1 5 A History
479 0 3 3 1 5 A History
Semester Relation raisedhands VisITedResources AnnouncementsView \
0 F Father 15 16 2
1 F Father 20 20 3
2 F Father 10 7 0
3 F Father 30 25 5
4 F Father 40 50 12
.. ... ... ... ... ...
475 S Father 5 4 5
476 F Father 50 77 14
477 S Father 55 74 25
478 F Father 30 17 14
479 S Father 35 14 23
Discussion ParentAnsweringSurvey ParentschoolSatisfaction Class
0 20 Yes Good M
1 25 Yes Good M
2 30 No Bad L
3 35 No Bad L
4 50 No Bad M
.. ... ... ... ...
475 8 No Bad L
476 28 No Bad M
477 29 No Bad M
478 57 No Bad L
479 62 No Bad L
[480 rows x 16 columns]
gender NationalITy PlaceofBirth StageID GradeID SectionID \
0 1 4 4 2 1 0
1 1 4 4 2 1 0
2 1 4 4 2 1 0
3 1 4 4 2 1 0
4 1 4 4 2 1 0
.. ... ... ... ... ... ...
475 0 3 3 1 5 0
476 0 3 3 1 5 0
477 0 3 3 1 5 0
478 0 3 3 1 5 0
479 0 3 3 1 5 0
Topic Semester Relation raisedhands VisITedResources \
0 IT F Father 15 16
1 IT F Father 20 20
2 IT F Father 10 7
3 IT F Father 30 25
4 IT F Father 40 50
.. ... ... ... ... ...
475 Chemistry S Father 5 4
476 Geology F Father 50 77
477 Geology S Father 55 74
478 History F Father 30 17
479 History S Father 35 14
AnnouncementsView Discussion ParentAnsweringSurvey \
0 2 20 Yes
1 3 25 Yes
2 0 30 No
3 5 35 No
4 12 50 No
.. ... ... ...
475 5 8 No
476 14 28 No
477 25 29 No
478 14 57 No
479 23 62 No
ParentschoolSatisfaction Class
0 Good M
1 Good M
2 Bad L
3 Bad L
4 Bad M
.. ... ...
475 Bad L
476 Bad M
477 Bad M
478 Bad L
479 Bad L
[480 rows x 16 columns]
gender NationalITy PlaceofBirth StageID GradeID SectionID Topic \
0 1 4 4 2 1 0 7
1 1 4 4 2 1 0 7
2 1 4 4 2 1 0 7
3 1 4 4 2 1 0 7
4 1 4 4 2 1 0 7
.. ... ... ... ... ... ... ...
475 0 3 3 1 5 0 2
476 0 3 3 1 5 0 5
477 0 3 3 1 5 0 5
478 0 3 3 1 5 0 6
479 0 3 3 1 5 0 6
Semester Relation raisedhands VisITedResources AnnouncementsView \
0 F Father 15 16 2
1 F Father 20 20 3
2 F Father 10 7 0
3 F Father 30 25 5
4 F Father 40 50 12
.. ... ... ... ... ...
475 S Father 5 4 5
476 F Father 50 77 14
477 S Father 55 74 25
478 F Father 30 17 14
479 S Father 35 14 23
Discussion ParentAnsweringSurvey ParentschoolSatisfaction Class
0 20 Yes Good M
1 25 Yes Good M
2 30 No Bad L
3 35 No Bad L
4 50 No Bad M
.. ... ... ... ...
475 8 No Bad L
476 28 No Bad M
477 29 No Bad M
478 57 No Bad L
479 62 No Bad L
[480 rows x 16 columns]
gender NationalITy PlaceofBirth StageID GradeID SectionID Topic \
0 1 4 4 2 1 0 7
1 1 4 4 2 1 0 7
2 1 4 4 2 1 0 7
3 1 4 4 2 1 0 7
4 1 4 4 2 1 0 7
.. ... ... ... ... ... ... ...
475 0 3 3 1 5 0 2
476 0 3 3 1 5 0 5
477 0 3 3 1 5 0 5
478 0 3 3 1 5 0 6
479 0 3 3 1 5 0 6
Semester Relation raisedhands VisITedResources AnnouncementsView \
0 0 Father 15 16 2
1 0 Father 20 20 3
2 0 Father 10 7 0
3 0 Father 30 25 5
4 0 Father 40 50 12
.. ... ... ... ... ...
475 1 Father 5 4 5
476 0 Father 50 77 14
477 1 Father 55 74 25
478 0 Father 30 17 14
479 1 Father 35 14 23
Discussion ParentAnsweringSurvey ParentschoolSatisfaction Class
0 20 Yes Good M
1 25 Yes Good M
2 30 No Bad L
3 35 No Bad L
4 50 No Bad M
.. ... ... ... ...
475 8 No Bad L
476 28 No Bad M
477 29 No Bad M
478 57 No Bad L
479 62 No Bad L
[480 rows x 16 columns]
gender NationalITy PlaceofBirth StageID GradeID SectionID Topic \
0 1 4 4 2 1 0 7
1 1 4 4 2 1 0 7
2 1 4 4 2 1 0 7
3 1 4 4 2 1 0 7
4 1 4 4 2 1 0 7
.. ... ... ... ... ... ... ...
475 0 3 3 1 5 0 2
476 0 3 3 1 5 0 5
477 0 3 3 1 5 0 5
478 0 3 3 1 5 0 6
479 0 3 3 1 5 0 6
Semester Relation raisedhands VisITedResources AnnouncementsView \
0 0 0 15 16 2
1 0 0 20 20 3
2 0 0 10 7 0
3 0 0 30 25 5
4 0 0 40 50 12
.. ... ... ... ... ...
475 1 0 5 4 5
476 0 0 50 77 14
477 1 0 55 74 25
478 0 0 30 17 14
479 1 0 35 14 23
Discussion ParentAnsweringSurvey ParentschoolSatisfaction Class
0 20 Yes Good M
1 25 Yes Good M
2 30 No Bad L
3 35 No Bad L
4 50 No Bad M
.. ... ... ... ...
475 8 No Bad L
476 28 No Bad M
477 29 No Bad M
478 57 No Bad L
479 62 No Bad L
[480 rows x 16 columns]
gender NationalITy PlaceofBirth StageID GradeID SectionID Topic \
0 1 4 4 2 1 0 7
1 1 4 4 2 1 0 7
2 1 4 4 2 1 0 7
3 1 4 4 2 1 0 7
4 1 4 4 2 1 0 7
.. ... ... ... ... ... ... ...
475 0 3 3 1 5 0 2
476 0 3 3 1 5 0 5
477 0 3 3 1 5 0 5
478 0 3 3 1 5 0 6
479 0 3 3 1 5 0 6
Semester Relation raisedhands VisITedResources AnnouncementsView \
0 0 0 15 16 2
1 0 0 20 20 3
2 0 0 10 7 0
3 0 0 30 25 5
4 0 0 40 50 12
.. ... ... ... ... ...
475 1 0 5 4 5
476 0 0 50 77 14
477 1 0 55 74 25
478 0 0 30 17 14
479 1 0 35 14 23
Discussion ParentAnsweringSurvey ParentschoolSatisfaction Class
0 20 1 Good M
1 25 1 Good M
2 30 0 Bad L
3 35 0 Bad L
4 50 0 Bad M
.. ... ... ... ...
475 8 0 Bad L
476 28 0 Bad M
477 29 0 Bad M
478 57 0 Bad L
479 62 0 Bad L
[480 rows x 16 columns]
gender NationalITy PlaceofBirth StageID GradeID SectionID Topic \
0 1 4 4 2 1 0 7
1 1 4 4 2 1 0 7
2 1 4 4 2 1 0 7
3 1 4 4 2 1 0 7
4 1 4 4 2 1 0 7
.. ... ... ... ... ... ... ...
475 0 3 3 1 5 0 2
476 0 3 3 1 5 0 5
477 0 3 3 1 5 0 5
478 0 3 3 1 5 0 6
479 0 3 3 1 5 0 6
Semester Relation raisedhands VisITedResources AnnouncementsView \
0 0 0 15 16 2
1 0 0 20 20 3
2 0 0 10 7 0
3 0 0 30 25 5
4 0 0 40 50 12
.. ... ... ... ... ...
475 1 0 5 4 5
476 0 0 50 77 14
477 1 0 55 74 25
478 0 0 30 17 14
479 1 0 35 14 23
Discussion ParentAnsweringSurvey ParentschoolSatisfaction Class
0 20 1 1 M
1 25 1 1 M
2 30 0 0 L
3 35 0 0 L
4 50 0 0 M
.. ... ... ... ...
475 8 0 0 L
476 28 0 0 M
477 29 0 0 M
478 57 0 0 L
479 62 0 0 L
[480 rows x 16 columns]
gender NationalITy PlaceofBirth StageID GradeID SectionID Topic \
0 1 4 4 2 1 0 7
1 1 4 4 2 1 0 7
2 1 4 4 2 1 0 7
3 1 4 4 2 1 0 7
4 1 4 4 2 1 0 7
.. ... ... ... ... ... ... ...
475 0 3 3 1 5 0 2
476 0 3 3 1 5 0 5
477 0 3 3 1 5 0 5
478 0 3 3 1 5 0 6
479 0 3 3 1 5 0 6
Semester Relation raisedhands VisITedResources AnnouncementsView \
0 0 0 15 16 2
1 0 0 20 20 3
2 0 0 10 7 0
3 0 0 30 25 5
4 0 0 40 50 12
.. ... ... ... ... ...
475 1 0 5 4 5
476 0 0 50 77 14
477 1 0 55 74 25
478 0 0 30 17 14
479 1 0 35 14 23
Discussion ParentAnsweringSurvey ParentschoolSatisfaction Class
0 20 1 1 2
1 25 1 1 2
2 30 0 0 1
3 35 0 0 1
4 50 0 0 2
.. ... ... ... ...
475 8 0 0 1
476 28 0 0 2
477 29 0 0 2
478 57 0 0 1
479 62 0 0 1
[480 rows x 16 columns]
from sklearn.preprocessing import LabelEncoder
Features = data.drop('Class',axis=1)
Target = data['Class']
label = LabelEncoder()
Cat_colums = Features.dtypes.pipe(lambda Feature: Feature[Feature=='object']).index
for col in Cat_colums:
Features[col]=label.fit_transform(Features[col])
print(Features)
gender NationalITy PlaceofBirth StageID GradeID SectionID \
0 1 KW KuwaIT lowerlevel G-04 A
1 1 KW KuwaIT lowerlevel G-04 A
2 1 KW KuwaIT lowerlevel G-04 A
3 1 KW KuwaIT lowerlevel G-04 A
4 1 KW KuwaIT lowerlevel G-04 A
.. ... ... ... ... ... ...
475 0 Jordan Jordan MiddleSchool G-08 A
476 0 Jordan Jordan MiddleSchool G-08 A
477 0 Jordan Jordan MiddleSchool G-08 A
478 0 Jordan Jordan MiddleSchool G-08 A
479 0 Jordan Jordan MiddleSchool G-08 A
Topic Semester Relation raisedhands VisITedResources \
0 IT F Father 15 16
1 IT F Father 20 20
2 IT F Father 10 7
3 IT F Father 30 25
4 IT F Father 40 50
.. ... ... ... ... ...
475 Chemistry S Father 5 4
476 Geology F Father 50 77
477 Geology S Father 55 74
478 History F Father 30 17
479 History S Father 35 14
AnnouncementsView Discussion ParentAnsweringSurvey \
0 2 20 Yes
1 3 25 Yes
2 0 30 No
3 5 35 No
4 12 50 No
.. ... ... ...
475 5 8 No
476 14 28 No
477 25 29 No
478 14 57 No
479 23 62 No
ParentschoolSatisfaction StudentAbsenceDays
0 Good Under-7
1 Good Under-7
2 Bad Above-7
3 Bad Above-7
4 Bad Above-7
.. ... ...
475 Bad Above-7
476 Bad Under-7
477 Bad Under-7
478 Bad Above-7
479 Bad Above-7
[480 rows x 16 columns]
gender NationalITy PlaceofBirth StageID GradeID SectionID \
0 1 4 KuwaIT lowerlevel G-04 A
1 1 4 KuwaIT lowerlevel G-04 A
2 1 4 KuwaIT lowerlevel G-04 A
3 1 4 KuwaIT lowerlevel G-04 A
4 1 4 KuwaIT lowerlevel G-04 A
.. ... ... ... ... ... ...
475 0 3 Jordan MiddleSchool G-08 A
476 0 3 Jordan MiddleSchool G-08 A
477 0 3 Jordan MiddleSchool G-08 A
478 0 3 Jordan MiddleSchool G-08 A
479 0 3 Jordan MiddleSchool G-08 A
Topic Semester Relation raisedhands VisITedResources \
0 IT F Father 15 16
1 IT F Father 20 20
2 IT F Father 10 7
3 IT F Father 30 25
4 IT F Father 40 50
.. ... ... ... ... ...
475 Chemistry S Father 5 4
476 Geology F Father 50 77
477 Geology S Father 55 74
478 History F Father 30 17
479 History S Father 35 14
AnnouncementsView Discussion ParentAnsweringSurvey \
0 2 20 Yes
1 3 25 Yes
2 0 30 No
3 5 35 No
4 12 50 No
.. ... ... ...
475 5 8 No
476 14 28 No
477 25 29 No
478 14 57 No
479 23 62 No
ParentschoolSatisfaction StudentAbsenceDays
0 Good Under-7
1 Good Under-7
2 Bad Above-7
3 Bad Above-7
4 Bad Above-7
.. ... ...
475 Bad Above-7
476 Bad Under-7
477 Bad Under-7
478 Bad Above-7
479 Bad Above-7
[480 rows x 16 columns]
gender NationalITy PlaceofBirth StageID GradeID SectionID \
0 1 4 4 lowerlevel G-04 A
1 1 4 4 lowerlevel G-04 A
2 1 4 4 lowerlevel G-04 A
3 1 4 4 lowerlevel G-04 A
4 1 4 4 lowerlevel G-04 A
.. ... ... ... ... ... ...
475 0 3 3 MiddleSchool G-08 A
476 0 3 3 MiddleSchool G-08 A
477 0 3 3 MiddleSchool G-08 A
478 0 3 3 MiddleSchool G-08 A
479 0 3 3 MiddleSchool G-08 A
Topic Semester Relation raisedhands VisITedResources \
0 IT F Father 15 16
1 IT F Father 20 20
2 IT F Father 10 7
3 IT F Father 30 25
4 IT F Father 40 50
.. ... ... ... ... ...
475 Chemistry S Father 5 4
476 Geology F Father 50 77
477 Geology S Father 55 74
478 History F Father 30 17
479 History S Father 35 14
AnnouncementsView Discussion ParentAnsweringSurvey \
0 2 20 Yes
1 3 25 Yes
2 0 30 No
3 5 35 No
4 12 50 No
.. ... ... ...
475 5 8 No
476 14 28 No
477 25 29 No
478 14 57 No
479 23 62 No
ParentschoolSatisfaction StudentAbsenceDays
0 Good Under-7
1 Good Under-7
2 Bad Above-7
3 Bad Above-7
4 Bad Above-7
.. ... ...
475 Bad Above-7
476 Bad Under-7
477 Bad Under-7
478 Bad Above-7
479 Bad Above-7
[480 rows x 16 columns]
gender NationalITy PlaceofBirth StageID GradeID SectionID Topic \
0 1 4 4 2 G-04 A IT
1 1 4 4 2 G-04 A IT
2 1 4 4 2 G-04 A IT
3 1 4 4 2 G-04 A IT
4 1 4 4 2 G-04 A IT
.. ... ... ... ... ... ... ...
475 0 3 3 1 G-08 A Chemistry
476 0 3 3 1 G-08 A Geology
477 0 3 3 1 G-08 A Geology
478 0 3 3 1 G-08 A History
479 0 3 3 1 G-08 A History
Semester Relation raisedhands VisITedResources AnnouncementsView \
0 F Father 15 16 2
1 F Father 20 20 3
2 F Father 10 7 0
3 F Father 30 25 5
4 F Father 40 50 12
.. ... ... ... ... ...
475 S Father 5 4 5
476 F Father 50 77 14
477 S Father 55 74 25
478 F Father 30 17 14
479 S Father 35 14 23
Discussion ParentAnsweringSurvey ParentschoolSatisfaction \
0 20 Yes Good
1 25 Yes Good
2 30 No Bad
3 35 No Bad
4 50 No Bad
.. ... ... ...
475 8 No Bad
476 28 No Bad
477 29 No Bad
478 57 No Bad
479 62 No Bad
StudentAbsenceDays
0 Under-7
1 Under-7
2 Above-7
3 Above-7
4 Above-7
.. ...
475 Above-7
476 Under-7
477 Under-7
478 Above-7
479 Above-7
[480 rows x 16 columns]
gender NationalITy PlaceofBirth StageID GradeID SectionID Topic \
0 1 4 4 2 1 A IT
1 1 4 4 2 1 A IT
2 1 4 4 2 1 A IT
3 1 4 4 2 1 A IT
4 1 4 4 2 1 A IT
.. ... ... ... ... ... ... ...
475 0 3 3 1 5 A Chemistry
476 0 3 3 1 5 A Geology
477 0 3 3 1 5 A Geology
478 0 3 3 1 5 A History
479 0 3 3 1 5 A History
Semester Relation raisedhands VisITedResources AnnouncementsView \
0 F Father 15 16 2
1 F Father 20 20 3
2 F Father 10 7 0
3 F Father 30 25 5
4 F Father 40 50 12
.. ... ... ... ... ...
475 S Father 5 4 5
476 F Father 50 77 14
477 S Father 55 74 25
478 F Father 30 17 14
479 S Father 35 14 23
Discussion ParentAnsweringSurvey ParentschoolSatisfaction \
0 20 Yes Good
1 25 Yes Good
2 30 No Bad
3 35 No Bad
4 50 No Bad
.. ... ... ...
475 8 No Bad
476 28 No Bad
477 29 No Bad
478 57 No Bad
479 62 No Bad
StudentAbsenceDays
0 Under-7
1 Under-7
2 Above-7
3 Above-7
4 Above-7
.. ...
475 Above-7
476 Under-7
477 Under-7
478 Above-7
479 Above-7
[480 rows x 16 columns]
gender NationalITy PlaceofBirth StageID GradeID SectionID \
0 1 4 4 2 1 0
1 1 4 4 2 1 0
2 1 4 4 2 1 0
3 1 4 4 2 1 0
4 1 4 4 2 1 0
.. ... ... ... ... ... ...
475 0 3 3 1 5 0
476 0 3 3 1 5 0
477 0 3 3 1 5 0
478 0 3 3 1 5 0
479 0 3 3 1 5 0
Topic Semester Relation raisedhands VisITedResources \
0 IT F Father 15 16
1 IT F Father 20 20
2 IT F Father 10 7
3 IT F Father 30 25
4 IT F Father 40 50
.. ... ... ... ... ...
475 Chemistry S Father 5 4
476 Geology F Father 50 77
477 Geology S Father 55 74
478 History F Father 30 17
479 History S Father 35 14
AnnouncementsView Discussion ParentAnsweringSurvey \
0 2 20 Yes
1 3 25 Yes
2 0 30 No
3 5 35 No
4 12 50 No
.. ... ... ...
475 5 8 No
476 14 28 No
477 25 29 No
478 14 57 No
479 23 62 No
ParentschoolSatisfaction StudentAbsenceDays
0 Good Under-7
1 Good Under-7
2 Bad Above-7
3 Bad Above-7
4 Bad Above-7
.. ... ...
475 Bad Above-7
476 Bad Under-7
477 Bad Under-7
478 Bad Above-7
479 Bad Above-7
[480 rows x 16 columns]
gender NationalITy PlaceofBirth StageID GradeID SectionID Topic \
0 1 4 4 2 1 0 7
1 1 4 4 2 1 0 7
2 1 4 4 2 1 0 7
3 1 4 4 2 1 0 7
4 1 4 4 2 1 0 7
.. ... ... ... ... ... ... ...
475 0 3 3 1 5 0 2
476 0 3 3 1 5 0 5
477 0 3 3 1 5 0 5
478 0 3 3 1 5 0 6
479 0 3 3 1 5 0 6
Semester Relation raisedhands VisITedResources AnnouncementsView \
0 F Father 15 16 2
1 F Father 20 20 3
2 F Father 10 7 0
3 F Father 30 25 5
4 F Father 40 50 12
.. ... ... ... ... ...
475 S Father 5 4 5
476 F Father 50 77 14
477 S Father 55 74 25
478 F Father 30 17 14
479 S Father 35 14 23
Discussion ParentAnsweringSurvey ParentschoolSatisfaction \
0 20 Yes Good
1 25 Yes Good
2 30 No Bad
3 35 No Bad
4 50 No Bad
.. ... ... ...
475 8 No Bad
476 28 No Bad
477 29 No Bad
478 57 No Bad
479 62 No Bad
StudentAbsenceDays
0 Under-7
1 Under-7
2 Above-7
3 Above-7
4 Above-7
.. ...
475 Above-7
476 Under-7
477 Under-7
478 Above-7
479 Above-7
[480 rows x 16 columns]
gender NationalITy PlaceofBirth StageID GradeID SectionID Topic \
0 1 4 4 2 1 0 7
1 1 4 4 2 1 0 7
2 1 4 4 2 1 0 7
3 1 4 4 2 1 0 7
4 1 4 4 2 1 0 7
.. ... ... ... ... ... ... ...
475 0 3 3 1 5 0 2
476 0 3 3 1 5 0 5
477 0 3 3 1 5 0 5
478 0 3 3 1 5 0 6
479 0 3 3 1 5 0 6
Semester Relation raisedhands VisITedResources AnnouncementsView \
0 0 Father 15 16 2
1 0 Father 20 20 3
2 0 Father 10 7 0
3 0 Father 30 25 5
4 0 Father 40 50 12
.. ... ... ... ... ...
475 1 Father 5 4 5
476 0 Father 50 77 14
477 1 Father 55 74 25
478 0 Father 30 17 14
479 1 Father 35 14 23
Discussion ParentAnsweringSurvey ParentschoolSatisfaction \
0 20 Yes Good
1 25 Yes Good
2 30 No Bad
3 35 No Bad
4 50 No Bad
.. ... ... ...
475 8 No Bad
476 28 No Bad
477 29 No Bad
478 57 No Bad
479 62 No Bad
StudentAbsenceDays
0 Under-7
1 Under-7
2 Above-7
3 Above-7
4 Above-7
.. ...
475 Above-7
476 Under-7
477 Under-7
478 Above-7
479 Above-7
[480 rows x 16 columns]
gender NationalITy PlaceofBirth StageID GradeID SectionID Topic \
0 1 4 4 2 1 0 7
1 1 4 4 2 1 0 7
2 1 4 4 2 1 0 7
3 1 4 4 2 1 0 7
4 1 4 4 2 1 0 7
.. ... ... ... ... ... ... ...
475 0 3 3 1 5 0 2
476 0 3 3 1 5 0 5
477 0 3 3 1 5 0 5
478 0 3 3 1 5 0 6
479 0 3 3 1 5 0 6
Semester Relation raisedhands VisITedResources AnnouncementsView \
0 0 0 15 16 2
1 0 0 20 20 3
2 0 0 10 7 0
3 0 0 30 25 5
4 0 0 40 50 12
.. ... ... ... ... ...
475 1 0 5 4 5
476 0 0 50 77 14
477 1 0 55 74 25
478 0 0 30 17 14
479 1 0 35 14 23
Discussion ParentAnsweringSurvey ParentschoolSatisfaction \
0 20 Yes Good
1 25 Yes Good
2 30 No Bad
3 35 No Bad
4 50 No Bad
.. ... ... ...
475 8 No Bad
476 28 No Bad
477 29 No Bad
478 57 No Bad
479 62 No Bad
StudentAbsenceDays
0 Under-7
1 Under-7
2 Above-7
3 Above-7
4 Above-7
.. ...
475 Above-7
476 Under-7
477 Under-7
478 Above-7
479 Above-7
[480 rows x 16 columns]
gender NationalITy PlaceofBirth StageID GradeID SectionID Topic \
0 1 4 4 2 1 0 7
1 1 4 4 2 1 0 7
2 1 4 4 2 1 0 7
3 1 4 4 2 1 0 7
4 1 4 4 2 1 0 7
.. ... ... ... ... ... ... ...
475 0 3 3 1 5 0 2
476 0 3 3 1 5 0 5
477 0 3 3 1 5 0 5
478 0 3 3 1 5 0 6
479 0 3 3 1 5 0 6
Semester Relation raisedhands VisITedResources AnnouncementsView \
0 0 0 15 16 2
1 0 0 20 20 3
2 0 0 10 7 0
3 0 0 30 25 5
4 0 0 40 50 12
.. ... ... ... ... ...
475 1 0 5 4 5
476 0 0 50 77 14
477 1 0 55 74 25
478 0 0 30 17 14
479 1 0 35 14 23
Discussion ParentAnsweringSurvey ParentschoolSatisfaction \
0 20 1 Good
1 25 1 Good
2 30 0 Bad
3 35 0 Bad
4 50 0 Bad
.. ... ... ...
475 8 0 Bad
476 28 0 Bad
477 29 0 Bad
478 57 0 Bad
479 62 0 Bad
StudentAbsenceDays
0 Under-7
1 Under-7
2 Above-7
3 Above-7
4 Above-7
.. ...
475 Above-7
476 Under-7
477 Under-7
478 Above-7
479 Above-7
[480 rows x 16 columns]
gender NationalITy PlaceofBirth StageID GradeID SectionID Topic \
0 1 4 4 2 1 0 7
1 1 4 4 2 1 0 7
2 1 4 4 2 1 0 7
3 1 4 4 2 1 0 7
4 1 4 4 2 1 0 7
.. ... ... ... ... ... ... ...
475 0 3 3 1 5 0 2
476 0 3 3 1 5 0 5
477 0 3 3 1 5 0 5
478 0 3 3 1 5 0 6
479 0 3 3 1 5 0 6
Semester Relation raisedhands VisITedResources AnnouncementsView \
0 0 0 15 16 2
1 0 0 20 20 3
2 0 0 10 7 0
3 0 0 30 25 5
4 0 0 40 50 12
.. ... ... ... ... ...
475 1 0 5 4 5
476 0 0 50 77 14
477 1 0 55 74 25
478 0 0 30 17 14
479 1 0 35 14 23
Discussion ParentAnsweringSurvey ParentschoolSatisfaction \
0 20 1 1
1 25 1 1
2 30 0 0
3 35 0 0
4 50 0 0
.. ... ... ...
475 8 0 0
476 28 0 0
477 29 0 0
478 57 0 0
479 62 0 0
StudentAbsenceDays
0 Under-7
1 Under-7
2 Above-7
3 Above-7
4 Above-7
.. ...
475 Above-7
476 Under-7
477 Under-7
478 Above-7
479 Above-7
[480 rows x 16 columns]
gender NationalITy PlaceofBirth StageID GradeID SectionID Topic \
0 1 4 4 2 1 0 7
1 1 4 4 2 1 0 7
2 1 4 4 2 1 0 7
3 1 4 4 2 1 0 7
4 1 4 4 2 1 0 7
.. ... ... ... ... ... ... ...
475 0 3 3 1 5 0 2
476 0 3 3 1 5 0 5
477 0 3 3 1 5 0 5
478 0 3 3 1 5 0 6
479 0 3 3 1 5 0 6
Semester Relation raisedhands VisITedResources AnnouncementsView \
0 0 0 15 16 2
1 0 0 20 20 3
2 0 0 10 7 0
3 0 0 30 25 5
4 0 0 40 50 12
.. ... ... ... ... ...
475 1 0 5 4 5
476 0 0 50 77 14
477 1 0 55 74 25
478 0 0 30 17 14
479 1 0 35 14 23
Discussion ParentAnsweringSurvey ParentschoolSatisfaction \
0 20 1 1
1 25 1 1
2 30 0 0
3 35 0 0
4 50 0 0
.. ... ... ...
475 8 0 0
476 28 0 0
477 29 0 0
478 57 0 0
479 62 0 0
StudentAbsenceDays
0 1
1 1
2 0
3 0
4 0
.. ...
475 0
476 1
477 1
478 0
479 0
[480 rows x 16 columns]
from sklearn.model_selection import train_test_split
from sklearn.neighbors import KNeighborsClassifier
X_train, X_test, y_train, y_test =train_test_split(Features, Target, test_size=0.2, random_state=52)
print(X_train)
print(X_test)
print(y_train)
print(y_test)
gender NationalITy PlaceofBirth StageID GradeID SectionID Topic \
299 1 3 3 2 1 0 10
348 1 5 5 2 0 1 4
162 0 3 3 2 0 1 4
467 0 3 3 1 5 0 5
306 1 3 3 2 1 1 10
.. ... ... ... ... ... ... ...
86 1 8 8 2 0 1 7
151 1 8 11 0 8 0 10
13 1 12 12 1 5 0 8
267 1 3 3 1 3 0 3
156 0 10 11 0 8 1 4
Semester Relation raisedhands VisITedResources AnnouncementsView \
299 1 0 32 14 32
348 0 1 20 3 9
162 1 1 70 82 3
467 1 1 87 93 63
306 0 1 65 59 74
.. ... ... ... ... ...
86 0 0 70 12 40
151 1 0 23 63 71
13 0 0 20 14 12
267 1 0 11 70 32
156 1 0 70 50 30
Discussion ParentAnsweringSurvey ParentschoolSatisfaction \
299 29 0 1
348 3 0 1
162 73 0 0
467 60 1 1
306 83 1 1
.. ... ... ...
86 50 1 1
151 89 1 1
13 19 0 0
267 29 1 1
156 49 1 1
StudentAbsenceDays
299 0
348 0
162 1
467 1
306 1
.. ...
86 1
151 1
13 0
267 0
156 1
[384 rows x 16 columns]
gender NationalITy PlaceofBirth StageID GradeID SectionID Topic \
103 1 4 4 2 0 1 7
431 1 3 8 1 5 0 5
475 0 3 3 1 5 0 2
231 1 9 3 1 5 0 11
400 1 3 3 1 4 0 1
.. ... ... ... ... ... ... ...
1 1 4 4 2 1 0 7
43 0 4 4 0 6 0 7
149 0 3 12 1 4 0 9
437 1 3 3 1 5 0 5
393 0 2 2 1 4 0 1
Semester Relation raisedhands VisITedResources AnnouncementsView \
103 0 0 1 7 6
431 1 0 80 89 23
475 1 0 5 4 5
231 1 0 9 7 21
400 0 0 39 71 40
.. ... ... ... ... ...
1 0 0 20 20 3
43 0 0 30 35 28
149 1 1 100 75 50
437 1 1 70 83 70
393 1 1 90 90 57
Discussion ParentAnsweringSurvey ParentschoolSatisfaction \
103 10 0 0
431 68 0 0
475 8 0 0
231 20 1 1
400 26 0 1
.. ... ... ...
1 25 1 1
43 90 1 1
149 70 1 0
437 23 1 1
393 22 1 1
StudentAbsenceDays
103 0
431 1
475 0
231 0
400 0
.. ...
1 1
43 1
149 1
437 1
393 1
[96 rows x 16 columns]
299 M
348 L
162 H
467 H
306 H
..
86 H
151 M
13 L
267 M
156 M
Name: Class, Length: 384, dtype: object
103 L
431 H
475 L
231 L
400 M
..
1 M
43 M
149 H
437 M
393 H
Name: Class, Length: 96, dtype: object
from sklearn.linear_model import LogisticRegression
Logit_Model=LogisticRegression()
Logit_Model.fit(X_train,y_train)
C:\Users\Intizar Mehdi PC\anaconda3\lib\site-packages\sklearn\linear_model\_logistic.py:458: ConvergenceWarning: lbfgs failed to converge (status=1):
STOP: TOTAL NO. of ITERATIONS REACHED LIMIT.
Increase the number of iterations (max_iter) or scale the data as shown in:
https://scikit-learn.org/stable/modules/preprocessing.html
Please also refer to the documentation for alternative solver options:
https://scikit-learn.org/stable/modules/linear_model.html#logistic-regression
n_iter_i = _check_optimize_result(
LogisticRegression()In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
LogisticRegression()
from sklearn.metrics import confusion_matrix,classification_report,accuracy_score
Prediction = Logit_Model.predict(X_test)
Score = accuracy_score(y_test,Prediction)
Report = classification_report(y_test,Prediction)
print(Prediction)
['L' 'M' 'L' 'L' 'M' 'L' 'M' 'H' 'M' 'M' 'M' 'L' 'H' 'L' 'M' 'L' 'H' 'M' 'M' 'M' 'H' 'H' 'L' 'L' 'H' 'L' 'M' 'H' 'H' 'M' 'M' 'H' 'L' 'M' 'M' 'L' 'L' 'L' 'H' 'L' 'M' 'M' 'M' 'M' 'H' 'L' 'M' 'L' 'M' 'L' 'H' 'H' 'M' 'H' 'H' 'M' 'H' 'L' 'L' 'H' 'L' 'H' 'M' 'M' 'H' 'H' 'L' 'L' 'H' 'H' 'H' 'H' 'H' 'H' 'H' 'H' 'M' 'H' 'M' 'H' 'L' 'H' 'M' 'M' 'L' 'M' 'M' 'M' 'M' 'M' 'L' 'M' 'M' 'H' 'M' 'H']
print(Score)
0.7604166666666666
print(Report)
precision recall f1-score support
H 0.79 0.74 0.76 35
L 0.77 0.91 0.83 22
M 0.73 0.69 0.71 39
accuracy 0.76 96
macro avg 0.76 0.78 0.77 96
weighted avg 0.76 0.76 0.76 96